Search in sources :

Example 1 with MBusSecondaryAddress

use of net.solarnetwork.node.io.mbus.MBusSecondaryAddress in project solarnetwork-node by SolarNetwork.

the class MBusSecondaryAddressTests method isValid_valid.

@Test
public void isValid_valid() {
    // GIVEN
    MBusSecondaryAddress addr = new MBusSecondaryAddress("1234567890ABCDEF");
    // THEN
    assertThat("Invalid address", addr.isValid(), is(true));
}
Also used : MBusSecondaryAddress(net.solarnetwork.node.io.mbus.MBusSecondaryAddress) Test(org.junit.Test)

Example 2 with MBusSecondaryAddress

use of net.solarnetwork.node.io.mbus.MBusSecondaryAddress in project solarnetwork-node by SolarNetwork.

the class MBusSecondaryAddressTests method equals_identity.

@Test
public void equals_identity() throws DecoderException {
    // GIVEN
    final byte[] data = decodeHex("1234567890ABCDEF");
    MBusSecondaryAddress addr = new MBusSecondaryAddress(data);
    // THEN
    assertThat("Addresses equal for same byte array instance", addr.equals(new MBusSecondaryAddress(data)), is(true));
}
Also used : MBusSecondaryAddress(net.solarnetwork.node.io.mbus.MBusSecondaryAddress) Test(org.junit.Test)

Example 3 with MBusSecondaryAddress

use of net.solarnetwork.node.io.mbus.MBusSecondaryAddress in project solarnetwork-node by SolarNetwork.

the class MBusSecondaryAddressTests method equals_content.

@Test
public void equals_content() throws DecoderException {
    MBusSecondaryAddress addr = new MBusSecondaryAddress(decodeHex("1234567890ABCDEF"));
    // THEN
    assertThat("Addresses equal for same byte array instance", addr.equals(new MBusSecondaryAddress(decodeHex("1234567890ABCDEF"))), is(true));
}
Also used : MBusSecondaryAddress(net.solarnetwork.node.io.mbus.MBusSecondaryAddress) Test(org.junit.Test)

Example 4 with MBusSecondaryAddress

use of net.solarnetwork.node.io.mbus.MBusSecondaryAddress in project solarnetwork-node by SolarNetwork.

the class MBusSecondaryAddressTests method notEquals.

@Test
public void notEquals() throws DecoderException {
    MBusSecondaryAddress addr = new MBusSecondaryAddress(decodeHex("1234567890ABCDEF"));
    // THEN
    assertThat("Addresses equal for same byte array instance", addr.equals(new MBusSecondaryAddress(decodeHex("01234567890ABCDE"))), is(false));
}
Also used : MBusSecondaryAddress(net.solarnetwork.node.io.mbus.MBusSecondaryAddress) Test(org.junit.Test)

Example 5 with MBusSecondaryAddress

use of net.solarnetwork.node.io.mbus.MBusSecondaryAddress in project solarnetwork-node by SolarNetwork.

the class MBusSecondaryAddressTests method isValid_invalid.

@Test
public void isValid_invalid() {
    // GIVEN
    MBusSecondaryAddress addr = new MBusSecondaryAddress("0000000000000000");
    // THEN
    assertThat("Invalid address", addr.isValid(), is(false));
}
Also used : MBusSecondaryAddress(net.solarnetwork.node.io.mbus.MBusSecondaryAddress) Test(org.junit.Test)

Aggregations

MBusSecondaryAddress (net.solarnetwork.node.io.mbus.MBusSecondaryAddress)5 Test (org.junit.Test)5