fix another test

This commit is contained in:
Michael Hoennig 2024-06-06 09:39:16 +02:00
parent 2848f4080c
commit 94039fffee

View File

@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test;
import jakarta.validation.ValidationException;
import static net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType.CLOUD_SERVER;
import static net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType.MANAGED_SERVER;
import static net.hostsharing.hsadminng.hs.hosting.asset.validators.HsHostingAssetEntityValidators.valid;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
@ -15,19 +15,18 @@ class HsHostingAssetEntityValidatorsUnitTest {
@Test
void validThrowsException() {
// given
final var cloudServerHostingAssetEntity = HsHostingAssetEntity.builder()
.type(CLOUD_SERVER)
final var managedServerHostingAssetEntity = HsHostingAssetEntity.builder()
.type(MANAGED_SERVER)
.build();
// when
final var result = catchThrowable( ()-> valid(cloudServerHostingAssetEntity) );
final var result = catchThrowable( ()-> valid(managedServerHostingAssetEntity) );
// then
assertThat(result).isInstanceOf(ValidationException.class)
.hasMessageContaining(
"'config.CPUs' is required but missing",
"'config.RAM' is required but missing",
"'config.SSD' is required but missing",
"'config.Traffic' is required but missing");
"'config.monit_max_ssd_usage' is required but missing",
"'config.monit_max_cpu_usage' is required but missing",
"'config.monit_max_ram_usage' is required but missing");
}
}