Advertisement
Aldin-SXR

MaxIntegerTest

Feb 27th, 2020
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. package ds.intro;
  2.  
  3. import static org.junit.jupiter.api.Assertions.*;
  4.  
  5. import org.junit.jupiter.api.AfterAll;
  6. import org.junit.jupiter.api.AfterEach;
  7. import org.junit.jupiter.api.BeforeAll;
  8. import org.junit.jupiter.api.BeforeEach;
  9. import org.junit.jupiter.api.Test;
  10.  
  11. class MaxIntegerTest {
  12.     static int[] numbers;
  13.  
  14.     @BeforeAll
  15.     static void setUpBeforeClass() throws Exception {
  16.         numbers = MaxInteger.readNumbers("/home/aldin-sxr/numbers.txt");
  17.     }
  18.  
  19.     @AfterAll
  20.     static void tearDownAfterClass() throws Exception {
  21.         numbers = null;
  22.     }
  23.  
  24.     @BeforeEach
  25.     void setUp() throws Exception {
  26.     }
  27.  
  28.     @AfterEach
  29.     void tearDown() throws Exception {
  30.     }
  31.  
  32.     @Test
  33.     void testFindsCorrectMaximum() {
  34.         int maxNumber = MaxInteger.findMax(numbers);
  35.         assertEquals(800, maxNumber);
  36.     }
  37.    
  38.     @Test
  39.     void testDoesNotFindIncorrectMaximum() {
  40.         int maxNumber = MaxInteger.findMax(numbers);
  41.         assertNotEquals(42, maxNumber);
  42.     }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement