Merge pull request #4024 from myluckagain/BAEL-1645

BAEL-1645 fix
This commit is contained in:
José Carlos Valero Sánchez 2018-04-16 23:05:19 +01:00 committed by GitHub
commit c80befe225
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View File

@ -39,8 +39,8 @@ public class Car {
// ...
}
public void сhangeOilWithIsNull(String oil) {
Assert.isNull(oil, "oil must be null");
public void replaceBattery(CarBattery carBattery) {
Assert.isNull(carBattery.getCharge(), "to replace battery the charge must be null");
// ...
}
@ -99,7 +99,9 @@ public class Car {
car.fuel();
car.сhangeOil("oil");
car.сhangeOilWithIsNull(null);
CarBattery carBattery = new CarBattery();
car.replaceBattery(carBattery);
car.сhangeEngine(new ToyotaEngine());

View File

@ -0,0 +1,13 @@
package com.baeldung.assertions;
public class CarBattery {
private String charge;
public String getCharge() {
return charge;
}
public void setCharge(String charge) {
this.charge = charge;
}
}