DlmsDevice extends AbstractEntity { public boolean needsInvocationCounter() { return this.hls5Active && "SMR".equals(this.protocolName); } DlmsDevice();  DlmsDevice(final String deviceIdentification); String getDeviceIdentification(); long getDeviceId(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode(); boolean isIpAddressIsStatic(); void setIpAddressIsStatic(final boolean ipAddressIsStatic); String getCommunicationMethod(); void setCommunicationMethod(final String communicationMethod); String getCommunicationProvider(); void setCommunicationProvider(final String communicationProvider); void setIccId(final String value); String getIccId(); boolean isLls1Active(); void setLls1Active(final boolean lls1Active); boolean isHls3Active(); void setHls3Active(final boolean hls3Active); boolean isHls4Active(); void setHls4Active(final boolean hls4Active); boolean isHls5Active(); void setHls5Active(final boolean hls5Active); Integer getChallengeLength(); void setChallengeLength(final Integer challengeLength); boolean isWithListSupported(); void setWithListSupported(final boolean withListSupported); boolean isSelectiveAccessSupported(); void setSelectiveAccessSupported(final boolean selectiveAccessSupported); void setDeviceIdentification(final String deviceIdentification); List<SecurityKey> getSecurityKeys(); void addSecurityKey(final SecurityKey securityKey); Long getPort(); void setPort(final Long port); Long getClientId(); void setClientId(final Long clientId); Long getLogicalId(); void setLogicalId(final Long logicalId); boolean isInDebugMode(); void setInDebugMode(final boolean inDebugMode); boolean isUseHdlc(); void setUseHdlc(final boolean useHdlc); boolean isUseSn(); void setUseSn(final boolean useSn); Long getMbusIdentificationNumber(); void setMbusIdentificationNumber(final Long mbusIdentificationNumber); String getManufacturerId(); String getMbusManufacturerIdentification(); void setMbusManufacturerIdentification(final String mbusManufacturerIdentification); String getProtocolName(); String getProtocolVersion(); void setProtocol(final String protocol, final String protocolVersion); void setProtocol(final Protocol protocol); String getIpAddress(); void setIpAddress(final String ipAddress); Long getInvocationCounter(); boolean isInvocationCounterInitialized(); void setInvocationCounter(final Long invocationCounter); void incrementInvocationCounter(final int amount); boolean needsInvocationCounter(); SecurityKey getValidSecurityKey(final SecurityKeyType securityKeyType); boolean hasNewSecurityKey(); SecurityKey getNewSecurityKey(final SecurityKeyType securityKeyType); void discardInvalidKeys(); boolean communicateUnencrypted(); void promoteInvalidKey();  }
@Test public void returnsIfDeviceNeedsInvocationCounter() { assertThat(new DlmsDeviceBuilder().withHls5Active(true).withProtocol("SMR").build().needsInvocationCounter()) .isTrue(); assertThat(new DlmsDeviceBuilder().withHls5Active(false).withProtocol("SMR").build().needsInvocationCounter()) .isFalse(); assertThat(new DlmsDeviceBuilder().withHls5Active(true).withProtocol("DSMR").build().needsInvocationCounter()) .isFalse(); }