author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Thu, 30 Oct 2014 20:46:27 +0100 | |
changeset 408 | 9a439a79c6d0 |
parent 157 | ee434b99a4bf |
permissions | -rw-r--r-- |
jtulach@156 | 1 |
package org.apidesign.samples; |
jtulach@156 | 2 |
|
jtulach@156 | 3 |
import org.junit.Before; |
jtulach@156 | 4 |
import org.junit.Test; |
jtulach@156 | 5 |
import static org.junit.Assert.*; |
jtulach@156 | 6 |
|
jtulach@156 | 7 |
public class HundredPercentCoverageTest { |
jtulach@156 | 8 |
HundredPercentCoverage instance; |
jtulach@156 | 9 |
|
jtulach@156 | 10 |
public HundredPercentCoverageTest() { |
jtulach@156 | 11 |
} |
jtulach@156 | 12 |
|
jtulach@156 | 13 |
@Before |
jtulach@156 | 14 |
public void setUp() { |
jtulach@156 | 15 |
instance = new HundredPercentCoverage(); |
jtulach@156 | 16 |
} |
jtulach@156 | 17 |
|
jtulach@156 | 18 |
@Test |
jtulach@156 | 19 |
public void cover100PercentOfAllLinesBlocksAndStatements() { |
jtulach@156 | 20 |
assertEquals("init value + 5", 15, instance.add(5)); |
jtulach@156 | 21 |
assertEquals("division", 20, instance.percentageFrom(3)); |
jtulach@156 | 22 |
} |
jtulach@156 | 23 |
|
jtulach@156 | 24 |
@Test |
jtulach@156 | 25 |
public void stillThereIsAWayToFail() { |
jtulach@263 | 26 |
if (Boolean.getBoolean("no.failures")) return; |
jtulach@156 | 27 |
assertEquals("init value - 10", 0, instance.add(-10)); |
jtulach@157 | 28 |
assertEquals("division", 0, instance.percentageFrom(5)); |
jtulach@156 | 29 |
} |
jtulach@156 | 30 |
} |