mirror of
https://github.com/ysoftdevs/gradle-training.git
synced 2026-05-27 17:19:33 +02:00
initial import of project
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
apply plugin: 'java'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testCompile group: 'org.testng', name: 'testng', version: '6.+'
|
||||
}
|
||||
|
||||
test {
|
||||
useTestNG()
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
public class Calculator {
|
||||
|
||||
/** Internal counter */
|
||||
private int counter;
|
||||
|
||||
Calculator() {
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
|
||||
public int getCounter() {
|
||||
return counter;
|
||||
}
|
||||
|
||||
void add(int i) {
|
||||
counter += i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class TestCalculator {
|
||||
|
||||
@Test
|
||||
public void testAdd() {
|
||||
Calculator calc = new Calculator();
|
||||
calc.add(1);
|
||||
Assert.assertEquals(calc.getCounter(), 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user