/** * Specific method for converting list of <code>EndpointGroupStateDto</code> objects * to list of model objects <code>EndpointGroupState</code>. * * @param stateDtoList the state dto list * @return converted list of <code>EndpointGroupState</code> objects */ public static List<EndpointGroupState> convertDtoToModelList( List<EndpointGroupStateDto> stateDtoList) { List<EndpointGroupState> states = null; if (stateDtoList != null && !stateDtoList.isEmpty()) { states = new ArrayList<>(); for (EndpointGroupStateDto dto : stateDtoList) { EndpointGroupState state = new EndpointGroupState(); state.setConfigurationId(dto.getConfigurationId()); state.setEndpointGroupId(dto.getEndpointGroupId()); state.setProfileFilterId(dto.getProfileFilterId()); states.add(state); } } return states; }
@Test public void EndpointStateTest() { EndpointGroupStateDto state = new EndpointGroupStateDto(); String groupId = String.valueOf(RANDOM.nextInt(LIMIT)); String filterId = String.valueOf(RANDOM.nextInt(LIMIT)); String configId = String.valueOf(RANDOM.nextInt(LIMIT)); state.setConfigurationId(configId); state.setProfileFilterId(filterId); state.setEndpointGroupId(groupId); EndpointGroupState stateOne = new EndpointGroupState(state); EndpointGroupState stateTwo = new EndpointGroupState(); stateTwo.setConfigurationId(configId); stateTwo.setProfileFilterId(filterId); stateTwo.setEndpointGroupId(groupId); Assert.assertEquals(stateOne, stateTwo); Assert.assertEquals(stateOne.hashCode(), stateTwo.hashCode()); Assert.assertEquals(stateOne.toDto(), stateTwo.toDto()); Assert.assertEquals(stateOne.toString(), stateTwo.toString()); }