diff options
author | Liam Fallon <liam.fallon@est.tech> | 2023-01-12 09:35:07 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2023-01-12 09:35:07 +0000 |
commit | 0b1764cac4b0071b66295cf14bf43b22ed3bc20d (patch) | |
tree | 5e1b8faf09a75e62e8f67e7861e53d4de008a2b0 /models/src/test/java | |
parent | 61e76990d815368a0327f33f68a26e0d19ea7c98 (diff) | |
parent | 9805ab974b97fe89e4c7491a282665ffb3f9feff (diff) |
Merge "Refactor AcTypeState Update"
Diffstat (limited to 'models/src/test/java')
-rw-r--r-- | models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcTypeStateResolverTest.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcTypeStateResolverTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcTypeStateResolverTest.java new file mode 100644 index 000000000..bf27c3e4f --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcTypeStateResolverTest.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2023 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.models.acm.persistence.provider; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.models.acm.concepts.AcTypeState; +import org.onap.policy.clamp.models.acm.messages.rest.commissioning.PrimeOrder; + +class AcTypeStateResolverTest { + + @Test + void testAcTypeState() { + var acTypeStateResolver = new AcTypeStateResolver(); + var result = acTypeStateResolver.resolve(PrimeOrder.PRIME, AcTypeState.COMMISSIONED); + assertThat(result).isEqualTo(PrimeOrder.PRIME); + result = acTypeStateResolver.resolve(PrimeOrder.PRIME, AcTypeState.PRIMED); + assertThat(result).isEqualTo(PrimeOrder.PRIME); + result = acTypeStateResolver.resolve(PrimeOrder.PRIME, AcTypeState.PRIMING); + assertThat(result).isEqualTo(PrimeOrder.NONE); + result = acTypeStateResolver.resolve(PrimeOrder.PRIME, AcTypeState.DEPRIMING); + assertThat(result).isEqualTo(PrimeOrder.NONE); + + result = acTypeStateResolver.resolve(PrimeOrder.DEPRIME, AcTypeState.COMMISSIONED); + assertThat(result).isEqualTo(PrimeOrder.DEPRIME); + result = acTypeStateResolver.resolve(PrimeOrder.DEPRIME, AcTypeState.PRIMED); + assertThat(result).isEqualTo(PrimeOrder.DEPRIME); + result = acTypeStateResolver.resolve(PrimeOrder.DEPRIME, AcTypeState.PRIMING); + assertThat(result).isEqualTo(PrimeOrder.NONE); + result = acTypeStateResolver.resolve(PrimeOrder.DEPRIME, AcTypeState.DEPRIMING); + assertThat(result).isEqualTo(PrimeOrder.NONE); + + result = acTypeStateResolver.resolve(null, null); + assertThat(result).isEqualTo(PrimeOrder.NONE); + } +} |