Skip to content

Commit c80befe

Browse files
Merge pull request eugenp#4024 from myluckagain/BAEL-1645
BAEL-1645 fix
2 parents c2cb22c + 59e4608 commit c80befe

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

‎spring-5/src/main/java/com/baeldung/assertions/Car.java‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public void fuelwithSupplier() {
3939
// ...
4040
}
4141

42-
public void сhangeOilWithIsNull(String oil) {
43-
Assert.isNull(oil, "oil must be null");
42+
public void replaceBattery(CarBattery carBattery) {
43+
Assert.isNull(carBattery.getCharge(), "to replace battery the charge must be null");
4444
// ...
4545
}
4646

@@ -99,7 +99,9 @@ public static void main(String[] args) {
9999
car.fuel();
100100

101101
car.сhangeOil("oil");
102-
car.сhangeOilWithIsNull(null);
102+
103+
CarBattery carBattery = new CarBattery();
104+
car.replaceBattery(carBattery);
103105

104106
car.сhangeEngine(new ToyotaEngine());
105107

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.baeldung.assertions;
2+
3+
public class CarBattery {
4+
private String charge;
5+
6+
public String getCharge() {
7+
return charge;
8+
}
9+
10+
public void setCharge(String charge) {
11+
this.charge = charge;
12+
}
13+
}

0 commit comments

Comments
 (0)