Skip to content

Commit 16a9ad9

Browse files
authored
Merge pull request #112 from diffblue/mjlodge-patch-1
Fix up corebanking so it works better
2 parents 940593f + 00b1d5b commit 16a9ad9

File tree

2 files changed

+61
-7
lines changed

2 files changed

+61
-7
lines changed

pom.xml

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,50 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>io.diffblue.corebanking</groupId>
66
<artifactId>CoreBanking</artifactId>
7-
<version>1.0.0</version>
7+
<version>1.0.1-JUnit5</version>
88
<properties>
99
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1010
<maven.compiler.source>1.8</maven.compiler.source>
1111
<maven.compiler.target>1.8</maven.compiler.target>
12+
<jacoco.version>0.8.5</jacoco.version>
1213
</properties>
1314
<dependencies>
15+
<!-- Only for JCover -->
1416
<dependency>
15-
<groupId>junit</groupId>
16-
<artifactId>junit</artifactId>
17-
<version>4.13.2</version>
17+
<groupId>org.mockito</groupId>
18+
<artifactId>mockito-core</artifactId>
19+
<version>4.7.0</version>
1820
<scope>test</scope>
1921
</dependency>
22+
<dependency>
23+
<groupId>org.junit.jupiter</groupId>
24+
<artifactId>junit-jupiter-engine</artifactId>
25+
<version>5.5.2</version>
26+
<scope>test</scope>
27+
</dependency>
28+
<dependency>
29+
<groupId>org.jacoco</groupId>
30+
<artifactId>org.jacoco.agent</artifactId>
31+
<version>0.8.2</version>
32+
<scope>test</scope>
33+
<classifier>runtime</classifier>
34+
</dependency>
2035
</dependencies>
2136
<build>
2237
<plugins>
38+
<!-- DIFFBLUE -->
39+
<plugin>
40+
<groupId>org.pitest</groupId>
41+
<artifactId>pitest-maven</artifactId>
42+
<version>1.5.2</version>
43+
<dependencies>
44+
<dependency>
45+
<groupId>org.pitest</groupId>
46+
<artifactId>pitest-junit5-plugin</artifactId>
47+
<version>0.12</version>
48+
</dependency>
49+
</dependencies>
50+
</plugin>
2351
<plugin>
2452
<groupId>org.apache.maven.plugins</groupId>
2553
<artifactId>maven-assembly-plugin</artifactId>
@@ -52,7 +80,33 @@
5280
<plugin>
5381
<groupId>org.apache.maven.plugins</groupId>
5482
<artifactId>maven-surefire-plugin</artifactId>
55-
<version>3.0.0</version>
83+
<version>3.0.0-M3</version>
84+
<dependencies>
85+
<dependency>
86+
<groupId>org.junit.platform</groupId>
87+
<artifactId>junit-platform-surefire-provider</artifactId>
88+
<version>1.2.0</version>
89+
</dependency>
90+
</dependencies>
91+
</plugin>
92+
<plugin>
93+
<groupId>org.jacoco</groupId>
94+
<artifactId>jacoco-maven-plugin</artifactId>
95+
<version>${jacoco.version}</version>
96+
<executions>
97+
<execution>
98+
<goals>
99+
<goal>prepare-agent</goal>
100+
</goals>
101+
</execution>
102+
<execution>
103+
<id>report</id>
104+
<phase>prepare-package</phase>
105+
<goals>
106+
<goal>report</goal>
107+
</goals>
108+
</execution>
109+
</executions>
56110
</plugin>
57111
</plugins>
58112
</build>

src/main/java/io/diffblue/corebanking/account/Account.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void takeFromBalance(final long amount) throws AccountException {
9191
if (getAccountState() != AccountState.OPEN) {
9292
throw new AccountException("Cannot take from balance, account is closed.");
9393
}
94-
if (currentBalance + amount < 0) {
94+
if (currentBalance - amount < 0) {
9595
throw new AccountException(
9696
"Trying to take "
9797
+ amount
@@ -208,7 +208,7 @@ public class AccountStatement {
208208
private final List<Transaction> transactions;
209209

210210
/** Constructor. */
211-
private AccountStatement() {
211+
public AccountStatement() {
212212
transactions = new ArrayList<Transaction>();
213213
}
214214

0 commit comments

Comments
 (0)