groovy
import org.junit.Test
import static org.junit.Assert.assertEquals
class MathUtils {
static int add(int a, int b) {
return a + b
}
}
class MathUtilsTest {
@Test
void testAdd() {
assertEquals(5, MathUtils.add(2, 3))
}
}
groovy
import groovy.test.GroovyTestCase
class IntegrationTest extends GroovyTestCase {
void testIntegration() {
def result = someMethod()
assert result == "Hello World"
}
String someMethod() {
return "Hello World"
}
}
groovy
dependencies {
testImplementation 'org.codehaus.groovy:groovy-all:<version>'
testImplementation 'junit:junit:<version>'
}
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version><version></version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version><version></version>
<scope>test</scope>
</dependency>
</dependencies>