Answers for "@test annotation in junit"

1

@test annotation in junit

# Used in JAVA
 public class Example {
    @Test
    public void method() {
       org.junit.Assert.assertTrue( new ArrayList().isEmpty() );
    }
 }
Posted by: Guest on February-04-2021
0

junit test

import junit.framework.*;

public class JavaTest extends TestCase {
   protected int value1, value2;
   
   // assigning the values
   protected void setUp(){
      value1 = 3;
      value2 = 3;
   }

   // test method to add two values
   public void testAdd(){
      double result = value1 + value2;
      assertTrue(result == 6);
   }
}
Posted by: Guest on April-10-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language