@Test public void testConvertWhereEveryDataHasTransferredCorrectlyToResponseAndEntityDescriptionIsNullThenResultDescriptionShouldBeEmpty() { Blueprint source = createSource(); source.setDescription(null); source.setTags(JSON_TO_STRING.convertToEntityAttribute("{}")); BlueprintV4Response result = underTest.convert(source); Assert.assertNotNull(result); Assert.assertEquals(source.getResourceCrn(), result.getCrn()); Assert.assertEquals(source.getName(), result.getName()); Assert.assertNotNull(result.getDescription()); Assert.assertTrue(result.getDescription().isEmpty()); Assert.assertEquals(Integer.valueOf(source.getHostGroupCount()), result.getHostGroupCount()); Assert.assertEquals(source.getStatus(), result.getStatus()); Assert.assertNotNull(result.getTags()); Assert.assertTrue(result.getTags().isEmpty()); Assert.assertEquals(source.getBlueprintText(), result.getBlueprint()); }
@Override public BlueprintV4Response convert(Blueprint entity) { BlueprintV4Response blueprintJson = new BlueprintV4Response(); blueprintJson.setName(entity.getName()); blueprintJson.setDescription(entity.getDescription() == null ? "" : entity.getDescription()); blueprintJson.setHostGroupCount(entity.getHostGroupCount()); blueprintJson.setStatus(entity.getStatus()); blueprintJson.setTags(entity.getTags().getMap()); blueprintJson.setBlueprint(entity.getBlueprintText()); blueprintJson.setCrn(entity.getResourceCrn()); blueprintJson.setCreated(entity.getCreated()); return blueprintJson; }
BlueprintToBlueprintV4ResponseConverter extends AbstractConversionServiceAwareConverter<Blueprint, BlueprintV4Response> { @Override public BlueprintV4Response convert(Blueprint entity) { BlueprintV4Response blueprintJson = new BlueprintV4Response(); blueprintJson.setName(entity.getName()); blueprintJson.setDescription(entity.getDescription() == null ? "" : entity.getDescription()); blueprintJson.setHostGroupCount(entity.getHostGroupCount()); blueprintJson.setStatus(entity.getStatus()); blueprintJson.setTags(entity.getTags().getMap()); blueprintJson.setBlueprint(entity.getBlueprintText()); blueprintJson.setCrn(entity.getResourceCrn()); blueprintJson.setCreated(entity.getCreated()); return blueprintJson; } }
BlueprintToBlueprintV4ResponseConverter extends AbstractConversionServiceAwareConverter<Blueprint, BlueprintV4Response> { @Override public BlueprintV4Response convert(Blueprint entity) { BlueprintV4Response blueprintJson = new BlueprintV4Response(); blueprintJson.setName(entity.getName()); blueprintJson.setDescription(entity.getDescription() == null ? "" : entity.getDescription()); blueprintJson.setHostGroupCount(entity.getHostGroupCount()); blueprintJson.setStatus(entity.getStatus()); blueprintJson.setTags(entity.getTags().getMap()); blueprintJson.setBlueprint(entity.getBlueprintText()); blueprintJson.setCrn(entity.getResourceCrn()); blueprintJson.setCreated(entity.getCreated()); return blueprintJson; }  }
BlueprintToBlueprintV4ResponseConverter extends AbstractConversionServiceAwareConverter<Blueprint, BlueprintV4Response> { @Override public BlueprintV4Response convert(Blueprint entity) { BlueprintV4Response blueprintJson = new BlueprintV4Response(); blueprintJson.setName(entity.getName()); blueprintJson.setDescription(entity.getDescription() == null ? "" : entity.getDescription()); blueprintJson.setHostGroupCount(entity.getHostGroupCount()); blueprintJson.setStatus(entity.getStatus()); blueprintJson.setTags(entity.getTags().getMap()); blueprintJson.setBlueprint(entity.getBlueprintText()); blueprintJson.setCrn(entity.getResourceCrn()); blueprintJson.setCreated(entity.getCreated()); return blueprintJson; }  @Override BlueprintV4Response convert(Blueprint entity); }
BlueprintToBlueprintV4ResponseConverter extends AbstractConversionServiceAwareConverter<Blueprint, BlueprintV4Response> { @Override public BlueprintV4Response convert(Blueprint entity) { BlueprintV4Response blueprintJson = new BlueprintV4Response(); blueprintJson.setName(entity.getName()); blueprintJson.setDescription(entity.getDescription() == null ? "" : entity.getDescription()); blueprintJson.setHostGroupCount(entity.getHostGroupCount()); blueprintJson.setStatus(entity.getStatus()); blueprintJson.setTags(entity.getTags().getMap()); blueprintJson.setBlueprint(entity.getBlueprintText()); blueprintJson.setCrn(entity.getResourceCrn()); blueprintJson.setCreated(entity.getCreated()); return blueprintJson; }  @Override BlueprintV4Response convert(Blueprint entity);  }