@Test public void testConvertWithTwoInstancesAndOnlySpotInstances() { FreeIpaCreationDto request = FreeIpaCreationDto.builder() .withInstanceCountByGroup(2) .withAws(FreeIpaCreationAwsParametersDto.builder() .withSpot(FreeIpaCreationAwsSpotParametersDto.builder() .withPercentage(100) .withMaxPrice(0.9) .build()) .build()) .build(); FreeIpaResponse result = underTest.convert(request); assertNotNull(result); assertNotNull(result.getInstanceCountByGroup()); assertEquals(2, result.getInstanceCountByGroup()); assertEquals(100, result.getAws().getSpot().getPercentage()); assertEquals(0.9, result.getAws().getSpot().getMaxPrice()); }
public FreeIpaResponse convert(FreeIpaCreationDto freeIpaCreation) { if (freeIpaCreation == null) { return null; } else { FreeIpaResponse response = new FreeIpaResponse(); response.setInstanceCountByGroup(freeIpaCreation.getInstanceCountByGroup()); Optional.ofNullable(freeIpaCreation.getAws()) .map(this::convertAws) .ifPresent(response::setAws); return response; } }
FreeIpaConverter { public FreeIpaResponse convert(FreeIpaCreationDto freeIpaCreation) { if (freeIpaCreation == null) { return null; } else { FreeIpaResponse response = new FreeIpaResponse(); response.setInstanceCountByGroup(freeIpaCreation.getInstanceCountByGroup()); Optional.ofNullable(freeIpaCreation.getAws()) .map(this::convertAws) .ifPresent(response::setAws); return response; } } }
FreeIpaConverter { public FreeIpaResponse convert(FreeIpaCreationDto freeIpaCreation) { if (freeIpaCreation == null) { return null; } else { FreeIpaResponse response = new FreeIpaResponse(); response.setInstanceCountByGroup(freeIpaCreation.getInstanceCountByGroup()); Optional.ofNullable(freeIpaCreation.getAws()) .map(this::convertAws) .ifPresent(response::setAws); return response; } }  }
FreeIpaConverter { public FreeIpaResponse convert(FreeIpaCreationDto freeIpaCreation) { if (freeIpaCreation == null) { return null; } else { FreeIpaResponse response = new FreeIpaResponse(); response.setInstanceCountByGroup(freeIpaCreation.getInstanceCountByGroup()); Optional.ofNullable(freeIpaCreation.getAws()) .map(this::convertAws) .ifPresent(response::setAws); return response; } }  FreeIpaResponse convert(FreeIpaCreationDto freeIpaCreation); FreeIpaCreationDto convert(AttachedFreeIpaRequest request); }
FreeIpaConverter { public FreeIpaResponse convert(FreeIpaCreationDto freeIpaCreation) { if (freeIpaCreation == null) { return null; } else { FreeIpaResponse response = new FreeIpaResponse(); response.setInstanceCountByGroup(freeIpaCreation.getInstanceCountByGroup()); Optional.ofNullable(freeIpaCreation.getAws()) .map(this::convertAws) .ifPresent(response::setAws); return response; } }  FreeIpaResponse convert(FreeIpaCreationDto freeIpaCreation); FreeIpaCreationDto convert(AttachedFreeIpaRequest request);  }