commit
c80befe225
|
@ -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());
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue