@Test
public void shouldProperlyMapNetworkAddressCollectionIntoNetworkAddressEntityCollection()
    throws Exception {

  NetworkAddress networkAddress1 = NetworkAddress.builder()
      .ip("192.168.24.33")
      .port(9991)
      .build();
  NetworkAddress networkAddress2 = NetworkAddress.builder()
      .ip("192.168.53.88")
      .port(9944)
      .build();
  ArrayList<NetworkAddress> networkAddresses = new ArrayList<>();
  networkAddresses.add(networkAddress1);
  networkAddresses.add(networkAddress2);
  Collection<NetworkAddressEntity> networkAddressEntities =
      networkAddressEntityDataMapper.transformInverse(networkAddresses);
  assertThat(networkAddressEntities, notNullValue());
  assertThat(networkAddressEntities.size(), is(2));
  NetworkAddressEntity networkAddressEntity1 =
      (NetworkAddressEntity) networkAddressEntities.toArray()[0];
  assertThat(networkAddressEntity1, notNullValue());
  assertThat(networkAddressEntity1.ip(), is("192.168.24.33"));
  assertThat(networkAddressEntity1.port(), is(9991));
  NetworkAddressEntity networkAddressEntity2 =
      (NetworkAddressEntity) networkAddressEntities.toArray()[1];
  assertThat(networkAddressEntity2, notNullValue());
  assertThat(networkAddressEntity2.ip(), is("192.168.53.88"));
  assertThat(networkAddressEntity2.port(), is(9944));
}