diff --git a/spring-5/src/main/java/com/baeldung/assertions/Car.java b/spring-5/src/main/java/com/baeldung/assertions/Car.java index 4e210dfaab..599246c752 100644 --- a/spring-5/src/main/java/com/baeldung/assertions/Car.java +++ b/spring-5/src/main/java/com/baeldung/assertions/Car.java @@ -43,6 +43,11 @@ public class Car { Assert.isNull(oil, "oil must be null"); // ... } + + public void replaceBattery(CarBattery carBattery){ + Assert.isNull(carBattery.getCharge(), "to replace battery the charge must be null"); + // ... + } public void сhangeEngine(Engine engine) { Assert.isInstanceOf(ToyotaEngine.class, engine); diff --git a/spring-5/src/main/java/com/baeldung/assertions/CarBattery.java b/spring-5/src/main/java/com/baeldung/assertions/CarBattery.java new file mode 100644 index 0000000000..a75457a7ec --- /dev/null +++ b/spring-5/src/main/java/com/baeldung/assertions/CarBattery.java @@ -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; + } +}