testImplementation 'junit:junit:'
testImplementation 'junit:junit:4.13.2'
testImplementation 'junit:junit:'
testImplementation 'junit:junit:4.13.2'
java junit test
import org.junit.Assert;
import org.junit.Test;
public class Test {
public static int square(int n) {
return n * n;
}
@Test
public void squareTest() {
Assert.assertEquals(25, square(5));
Assert.assertEquals(16, square(4));
Assert.assertEquals(9, square(3));
Assert.assertEquals(4, square(2));
Assert.assertEquals(1, square(1));
}
}
@test annotation in junit
# Used in JAVA
public class Example {
@Test
public void method() {
org.junit.Assert.assertTrue( new ArrayList().isEmpty() );
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us