Skip to content

Commit 801ce70

Browse files
author
Peter Schrammel
committed
div with test
1 parent 7ff0bed commit 801ce70

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

main-module/pom.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,42 @@
1818
<scope>test</scope>
1919
</dependency>
2020
</dependencies>
21+
22+
<build>
23+
<plugins>
24+
<plugin>
25+
<groupId>org.apache.maven.plugins</groupId>
26+
<artifactId>maven-compiler-plugin</artifactId>
27+
<configuration>
28+
<source>1.8</source>
29+
<target>1.8</target>
30+
</configuration>
31+
</plugin>
32+
<plugin>
33+
<groupId>org.codehaus.mojo</groupId>
34+
<artifactId>cobertura-maven-plugin</artifactId>
35+
<configuration>
36+
<instrumentation>
37+
</instrumentation>
38+
</configuration>
39+
<executions>
40+
<execution>
41+
<id>clean</id>
42+
<phase>pre-site</phase>
43+
<goals>
44+
<goal>clean</goal>
45+
</goals>
46+
</execution>
47+
<execution>
48+
<id>instrument</id>
49+
<phase>site</phase>
50+
<goals>
51+
<goal>instrument</goal>
52+
<goal>cobertura</goal>
53+
</goals>
54+
</execution>
55+
</executions>
56+
</plugin>
57+
</plugins>
58+
</build>
2159
</project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.diffblue.java_test;
2+
3+
public class Calc
4+
{
5+
int div(int a, int b)
6+
{
7+
return a/b;
8+
}
9+
}

main-module/src/main/java/com/diffblue/java_test/Main.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ public class Main
44
{
55
void do_stuff(String a, String b)
66
{
7+
int x=Integer.parseInt(a);
8+
int y=Integer.parseInt(b);
9+
int z=new Calc().div(x,y);
10+
System.out.println(""+z);
711
}
812

913
public static void main(String[] args)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.diffblue.java_test;
2+
3+
import org.junit.*;
4+
5+
public class CalcTest
6+
{
7+
8+
@Test
9+
public void div0()
10+
{
11+
int r=new Calc().div(2,1);
12+
Assert.assertEquals(r,2);
13+
}
14+
15+
}

0 commit comments

Comments
 (0)