The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
TestCase2
By Guest on 5th September 2022 01:43:08 AM | Syntax: TEXT | Views: 1



New paste | Download | Show/Hide line no. | Copy text to clipboard
  1. package com.javatpoint.testcase;
  2.  
  3. import static org.junit.Assert.assertEquals;
  4. import org.junit.After;
  5. import org.junit.AfterClass;
  6. import org.junit.Before;
  7. import org.junit.BeforeClass;
  8. import org.junit.Test;
  9. import com.javatpoint.logic.Calculation;
  10.  
  11. public class TestCase2 {
  12.  
  13.         @BeforeClass
  14.         public static void setUpBeforeClass() throws Exception {
  15.                 System.out.println("before class");
  16.         }
  17.         @Before
  18.         public void setUp() throws Exception {
  19.                 System.out.println("before");
  20.         }
  21.  
  22.         @Test
  23.         public void testFindMax(){
  24.                 System.out.println("test case find max");
  25.                 assertEquals(4,Calculation.findMax(new int[]{1,3,4,2}));
  26.                 assertEquals(-2,Calculation.findMax(new int[]{-12,-3,-4,-2}));
  27.         }
  28.         @Test
  29.         public void testCube(){
  30.                 System.out.println("test case cube");
  31.                 assertEquals(27,Calculation.cube(3));
  32.         }
  33.        
  34.         @After
  35.         public void tearDown() throws Exception {
  36.                 System.out.println("after");
  37.         }
  38.  
  39.         @AfterClass
  40.         public static void tearDownAfterClass() throws Exception {
  41.                 System.out.println("after class");
  42.         }
  43.  
  44. }



  • Recent Pastes