LargestIntegerTest.java 934B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import org.junit.Assert;
  2. import org.junit.Before;
  3. import org.junit.Test;
  4. public class LargestIntegerTest {
  5. private LargestInteger largestInteger;
  6. @Before
  7. public void setUp(){
  8. largestInteger = new LargestInteger();
  9. }
  10. @Test
  11. public void findLargestNumberUsingConditionalTest(){
  12. // :Given
  13. Integer expected = 30;
  14. // :When
  15. Integer actual = largestInteger.findLargestNumberUsingConditional(new Integer[]{30,20,10});
  16. // :Then
  17. Assert.assertEquals("The Largest Number should be 30", expected, actual);
  18. }
  19. @Test
  20. public void findLargestNumberUsingMathMaxTest(){
  21. // :Given
  22. Integer expected = 600;
  23. // :When
  24. Integer actual = largestInteger.findLargestNumberUsingMathMax(new Integer[]{300,200,600});
  25. // :Then
  26. Assert.assertEquals("The Largest Number should be 600.", expected, actual);
  27. }
  28. }