diff --git a/src/test/java/IntegerDividerScalabilityTesterAsAServiceTestKevinsMasterProgram.java b/src/test/java/IntegerDividerScalabilityTesterAsAServiceTestKevinsMasterProgram.java new file mode 100644 index 00000000..75ddb862 --- /dev/null +++ b/src/test/java/IntegerDividerScalabilityTesterAsAServiceTestKevinsMasterProgram.java @@ -0,0 +1,42 @@ +import static org.junit.Assert.assertEquals; + +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; + +import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.math.arithmetics.IntegerDivider; +import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.strategies.comparators.doublecomparator.FirstIsLargerThanSecondDoubleComparator; +import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.strategies.comparators.doublecomparator.FirstIsSmallerThanSecondDoubleComparator; + +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * Tests to ensure redundancy and scalability of IntegerDivider architecture as a service...platform...yet + */ +public class IntegerDividerScalabilityTesterAsAServiceTestKevinsMasterProgram { + + private PrintStream out; + + /** + * @throws IOException + * @return void + */ + @Test + public void testIntegerDivisionOrElse() { + FirstIsSmallerThanSecondDoubleComparator firstIsSmallerThanSecondDoubleComparator = new FirstIsSmallerThanSecondDoubleComparator(); + FirstIsLargerThanSecondDoubleComparator firstIsLargerThanSecondDoubleComparator = new FirstIsLargerThanSecondDoubleComparator(); + + IntegerDivider intDivider = new IntegerDivider(firstIsLargerThanSecondDoubleComparator, firstIsSmallerThanSecondDoubleComparator); + + assertEquals(intDivider.divide(TestConstants.INT_10, TestConstants.INT_3), TestConstants.TEST_RESULT_INT_3); + assertEquals(intDivider.divide(TestConstants.INT_7, TestConstants.INT_4), TestConstants.TEST_RESULT_INT_1); + assertEquals(intDivider.divide(TestConstants.INT_10, TestConstants.NEGATIVE_INTEGER_3), TestConstants.TEST_RESULT_NEGATIVE_INT_3); + assertEquals(intDivider.divide(TestConstants.NEGATIVE_INTEGER_16, TestConstants.INT_3), TestConstants.TEST_RESULT_NEGATIVE_INT_5); + + } + +} diff --git a/src/test/java/TestConstants.java b/src/test/java/TestConstants.java index 6b8c5883..8ca496f4 100644 --- a/src/test/java/TestConstants.java +++ b/src/test/java/TestConstants.java @@ -41,5 +41,53 @@ private TestConstants() { static final int INT_14 = 14; static final int INT_15 = 15; static final int INT_16 = 16; + static final int NEGATIVE_INTEGER_1 = -1; + static final int NEGATIVE_INTEGER_2 = -2; + static final int NEGATIVE_INTEGER_3 = -3; + static final int NEGATIVE_INTEGER_4 = -4; + static final int NEGATIVE_INTEGER_5 = -5; + static final int NEGATIVE_INTEGER_6 = -6; + static final int NEGATIVE_INTEGER_7 = -7; + static final int NEGATIVE_INTEGER_8 = -8; + static final int NEGATIVE_INTEGER_9 = -9; + static final int NEGATIVE_INTEGER_10 = -10; + static final int NEGATIVE_INTEGER_11 = -11; + static final int NEGATIVE_INTEGER_12 = -12; + static final int NEGATIVE_INTEGER_13 = -13; + static final int NEGATIVE_INTEGER_14 = -14; + static final int NEGATIVE_INTEGER_15 = -15; + static final int NEGATIVE_INTEGER_16 = -16; + static final int TEST_RESULT_INT_1 = 1; + static final int TEST_RESULT_INT_2 = 2; + static final int TEST_RESULT_INT_3 = 3; + static final int TEST_RESULT_INT_4 = 4; + static final int TEST_RESULT_INT_5 = 5; + static final int TEST_RESULT_INT_6 = 6; + static final int TEST_RESULT_INT_7 = 7; + static final int TEST_RESULT_INT_8 = 8; + static final int TEST_RESULT_INT_9 = 9; + static final int TEST_RESULT_INT_10 = 10; + static final int TEST_RESULT_INT_11 = 11; + static final int TEST_RESULT_INT_12 = 12; + static final int TEST_RESULT_INT_13 = 13; + static final int TEST_RESULT_INT_14 = 14; + static final int TEST_RESULT_INT_15 = 15; + static final int TEST_RESULT_INT_16 = 16; + static final int TEST_RESULT_NEGATIVE_INT_1 = -1; + static final int TEST_RESULT_NEGATIVE_INT_2 = -2; + static final int TEST_RESULT_NEGATIVE_INT_3 = -3; + static final int TEST_RESULT_NEGATIVE_INT_4 = -4; + static final int TEST_RESULT_NEGATIVE_INT_5 = -5; + static final int TEST_RESULT_NEGATIVE_INT_6 = -6; + static final int TEST_RESULT_NEGATIVE_INT_7 = -7; + static final int TEST_RESULT_NEGATIVE_INT_8 = -8; + static final int TEST_RESULT_NEGATIVE_INT_9 = -9; + static final int TEST_RESULT_NEGATIVE_INT_10 = -10; + static final int TEST_RESULT_NEGATIVE_INT_11 = -11; + static final int TEST_RESULT_NEGATIVE_INT_12 = -12; + static final int TEST_RESULT_NEGATIVE_INT_13 = -13; + static final int TEST_RESULT_NEGATIVE_INT_14 = -14; + static final int TEST_RESULT_NEGATIVE_INT_15 = -15; + static final int TEST_RESULT_NEGATIVE_INT_16 = -16; -} +} \ No newline at end of file