hierarchical-validation-baseline #59

Merged
hsh-michaelhoennig merged 18 commits from hierarchical-validation-baseline into master 2024-06-14 16:48:01 +02:00
2 changed files with 8 additions and 8 deletions
Showing only changes of commit f379ae5cb2 - Show all commits

View File

@ -21,6 +21,8 @@ import java.util.List;
import java.util.UUID;
import java.util.function.BiConsumer;
import static net.hostsharing.hsadminng.hs.hosting.asset.validators.HsHostingAssetEntityValidatorRegistry.validated;
@RestController
public class HsHostingAssetController implements HsHostingAssetsApi {
@ -61,8 +63,7 @@ public class HsHostingAssetController implements HsHostingAssetsApi {
final var entityToSave = mapper.map(body, HsHostingAssetEntity.class, RESOURCE_TO_ENTITY_POSTMAPPER);
hsh-michaelhoennig marked this conversation as resolved Outdated

evtl. zusammenfassen

evtl. zusammenfassen
final HsHostingAssetEntity persistentEntity = assetRepo.save(entityToSave);
final var saved = HsHostingAssetEntityValidatorRegistry.validated(persistentEntity);
final var saved = validated(assetRepo.save(entityToSave));
final var uri =
MvcUriComponentsBuilder.fromController(getClass())
@ -117,8 +118,7 @@ public class HsHostingAssetController implements HsHostingAssetsApi {
new HsHostingAssetEntityPatcher(current).apply(body);
final HsHostingAssetEntity persistentEntity = assetRepo.save(current);
final var saved = HsHostingAssetEntityValidatorRegistry.validated(persistentEntity);
final var saved = validated(assetRepo.save(current));
hsh-michaelhoennig marked this conversation as resolved Outdated

zusammenfassen

zusammenfassen
final var mapped = mapper.map(saved, HsHostingAssetResource.class);
return ResponseEntity.ok(mapped);
}

View File

@ -38,10 +38,10 @@ class HsBookingItemEntityValidatorUnitTest {
// then
assertThat(result).isInstanceOf(ValidationException.class)
.hasMessageContaining(
"D-12345:test project:Test-Server.resources.CPUs' is required but missing",
"D-12345:test project:Test-Server.resources.RAM' is required but missing",
"D-12345:test project:Test-Server.resources.SSD' is required but missing",
"D-12345:test project:Test-Server.resources.Traffic' is required but missing");
"'D-12345:test project:Test-Server.resources.CPUs' is required but missing",
hsh-michaelhoennig marked this conversation as resolved Outdated

Hochkomma vorne einfügen

Hochkomma vorne einfügen
"'D-12345:test project:Test-Server.resources.RAM' is required but missing",
"'D-12345:test project:Test-Server.resources.SSD' is required but missing",
"'D-12345:test project:Test-Server.resources.Traffic' is required but missing");
}
@Test