### Question:
WashingMachine { public void wash() { synchronized (this) { var machineState = getWashingMachineState(); LOGGER.info("{}: Actual machine state: {}", Thread.currentThread().getName(), machineState); if (this.washingMachineState == WashingMachineState.WASHING) { LOGGER.error("ERROR: Cannot wash if the machine has been already washing!"); return; } this.washingMachineState = WashingMachineState.WASHING; } LOGGER.info("{}: Doing the washing", Thread.currentThread().getName()); this.delayProvider.executeAfterDelay(50, TimeUnit.MILLISECONDS, this::endOfWashing); } WashingMachine();  WashingMachine(DelayProvider delayProvider); WashingMachineState getWashingMachineState(); void wash(); synchronized void endOfWashing();  }### Answer:
@Test void wash() { var washingMachine = new WashingMachine(fakeDelayProvider); washingMachine.wash(); washingMachine.wash(); var machineStateGlobal = washingMachine.getWashingMachineState(); fakeDelayProvider.task.run(); assertEquals(WashingMachineState.WASHING, machineStateGlobal); assertEquals(WashingMachineState.ENABLED, washingMachine.getWashingMachineState()); }