Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding IntegerDivider test class #600

Open
wants to merge 1 commit into
base: uinverse
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused var?


/**
* @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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected result should be the first argument of the assertEquals call

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);

}

}
50 changes: 49 additions & 1 deletion src/test/java/TestConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other constants are INT_VAL=VAL. These should be NEG_INT_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;

}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline