### Question:
Evse { public long incrementPowerConsumed(long incrementValue) { long diff = Long.MAX_VALUE - totalConsumedWattHours; if (incrementValue > diff) { totalConsumedWattHours = incrementValue - diff - 1; } else { totalConsumedWattHours += incrementValue; } return totalConsumedWattHours; } Evse(int id, List<Connector> connectors);  Evse(int id, EvseStatus evseStatus, List<Connector> connectors);  Evse(int id, EvseStatus evseStatus, EvseTransaction transaction, List<Connector> connectors); Integer startCharging(); void stopCharging(); long getWattConsumedLastSession(); Long getSeqNoAndIncrement(); void setToken(String tokenId); String getTokenId(); AbstractEvseState getEvseState(); void setEvseState(AbstractEvseState evseState); void changeStatus(EvseStatus evseStatus); void setScheduledNewEvseStatus(EvseStatus scheduledNewEvseStatus); boolean hasStatus(EvseStatus requestedEvseStatus); boolean hasOngoingTransaction(); boolean hasTokenId(); void stopTransaction(); void createTransaction(String transactionId); void clearToken(); void plug(Integer connectorId); void unplug(Integer connectorId); Integer lockPluggedConnector(); Integer unlockConnector(); Integer tryUnlockConnector(); boolean isCablePlugged(); Optional<Connector> tryFindAvailableConnector(); Optional<Connector> tryFindPluggedConnector(); Connector findConnector(int connectorId); long incrementPowerConsumed(long incrementValue); @Override String toString(); EvseView createView();  }### Answer:
@Test void testPowerIncrement() { long startingPowerConsumed = evse.getTotalConsumedWattHours(); assertThat(startingPowerConsumed).isEqualTo(0); long incrementValue = 1000; for (int i = 1; i < 20; i++) { long incrementedValue = evse.incrementPowerConsumed(incrementValue); assertThat(incrementedValue).isEqualTo(incrementValue * i); assertThat(evse.getTotalConsumedWattHours()).isEqualTo(incrementValue * i); } }
@Test void testPowerIncrementOverflow() { long startingPowerConsumed = evse.getTotalConsumedWattHours(); assertThat(startingPowerConsumed).isEqualTo(0); long incrementValue = Long.MAX_VALUE - 150; assertThat(evse.incrementPowerConsumed(incrementValue)).isEqualTo(incrementValue); assertThat(evse.incrementPowerConsumed(100)).isEqualTo(incrementValue + 100); assertThat(evse.incrementPowerConsumed(100)).isEqualTo(49); }
@Test void testPowerIncrementRollToZero() { long startingPowerConsumed = evse.getTotalConsumedWattHours(); assertThat(startingPowerConsumed).isEqualTo(0); long startingValue = Long.MAX_VALUE - 10; assertThat(evse.incrementPowerConsumed(startingValue)).isEqualTo(startingValue); for (int i = 1; i <= 10; i++) { assertThat(evse.incrementPowerConsumed(1)).isEqualTo(startingValue + i); } assertThat(evse.getTotalConsumedWattHours()).isEqualTo(Long.MAX_VALUE); for (int i = 0; i <= 10; i++) { assertThat(evse.incrementPowerConsumed(1)).isEqualTo(i); } }