Sha256: 4ebe4b2cf2d4c5de224c62e5cda7c3f0ea7b0f0d5a3fc9424b7fed6f8ad3e0e5
Contents?: true
Size: 1.56 KB
Versions: 7
Compression:
Stored size: 1.56 KB
Contents
import org.junit.Before; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import static org.junit.Assert.assertEquals; /* * version: 1.0.0 */ public class CollatzCalculatorTest { @Rule public ExpectedException expectedException = ExpectedException.none(); private CollatzCalculator collatzCalculator; @Before public void setUp() { collatzCalculator = new CollatzCalculator(); } @Test public void testZeroStepsRequiredWhenStartingFrom1() { assertEquals(0, collatzCalculator.computeStepCount(1)); } @Ignore("Remove to run test") @Test public void testCorrectNumberOfStepsWhenAllStepsAreDivisions() { assertEquals(4, collatzCalculator.computeStepCount(16)); } @Ignore("Remove to run test") @Test public void testCorrectNumberOfStepsWhenBothStepTypesAreNeeded() { assertEquals(9, collatzCalculator.computeStepCount(12)); } @Ignore("Remove to run test") @Test public void testZeroIsConsideredInvalidInput() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Only natural numbers are allowed"); collatzCalculator.computeStepCount(0); } @Ignore("Remove to run test") @Test public void testNegativeIntegerIsConsideredInvalidInput() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Only natural numbers are allowed"); collatzCalculator.computeStepCount(-15); } }
Version data entries
7 entries across 7 versions & 1 rubygems