diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-06-24 14:09:30 +0100 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-07-05 09:20:43 +0000 |
commit | 47f2be812ff98c6d9d3862deb55638330e8db4f3 (patch) | |
tree | d0c86a1db92532c80b130ce205d896854c18f414 /openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api | |
parent | f9f5f68caee795d97221071fb26ebe0f572bae0d (diff) |
Remove usage of outdated library JMockit (openecomp-be)
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3379
Change-Id: I7430deaa5993e67293e0f290700274dc2fff2db1
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api')
3 files changed, 26 insertions, 43 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml index d09775fd19..28d4a1950a 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml @@ -54,11 +54,6 @@ <artifactId>openecomp-sdc-versioning-api</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.jmockit</groupId> - <artifactId>jmockit</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java index bd14e5a1e5..90399247c5 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.core.enrichment.types; import static org.openecomp.core.enrichment.types.MonitoringUploadType.SNMP_POLL; @@ -25,10 +26,12 @@ import static org.openecomp.core.enrichment.types.MonitoringUploadType.VES_EVENT import java.util.HashMap; import java.util.Map; +import lombok.NoArgsConstructor; +@NoArgsConstructor public class ComponentMonitoringUploadInfo { - private Map<MonitoringUploadType, MonitoringArtifactInfo> infoByType = new HashMap<>(); + private final Map<MonitoringUploadType, MonitoringArtifactInfo> infoByType = new HashMap<>(); public MonitoringArtifactInfo getSnmpTrap() { return infoByType.get(SNMP_TRAP); @@ -42,7 +45,8 @@ public class ComponentMonitoringUploadInfo { return infoByType.get(VES_EVENTS); } - public void setMonitoringArtifactFile(MonitoringUploadType type, MonitoringArtifactInfo monitoringArtifactInfo) { + public void setMonitoringArtifactFile(final MonitoringUploadType type, + final MonitoringArtifactInfo monitoringArtifactInfo) { infoByType.put(type, monitoringArtifactInfo); } } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/test/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfoTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/test/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfoTest.java index b857d0cc04..977f691c31 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/test/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfoTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/test/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfoTest.java @@ -16,59 +16,43 @@ package org.openecomp.core.enrichment.types; -import static org.hamcrest.CoreMatchers.isA; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import java.util.HashMap; -import java.util.Map; -import mockit.Deencapsulation; -import org.junit.Test; - -public class ComponentMonitoringUploadInfoTest { +class ComponentMonitoringUploadInfoTest { @Test - public void testGetSnmpTrap() { - ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); + void testGetSnmpTrap() { + final ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); setInternals(uploadInfo); - - assertThat(uploadInfo.getSnmpTrap(), isA(MonitoringArtifactInfo.class)); + Assertions.assertTrue(uploadInfo.getSnmpTrap() instanceof MonitoringArtifactInfo); } @Test - public void testGetSnmpPoll() { - ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); + void testGetSnmpPoll() { + final ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); setInternals(uploadInfo); - - assertThat(uploadInfo.getSnmpPoll(), isA(MonitoringArtifactInfo.class)); + Assertions.assertTrue(uploadInfo.getSnmpPoll() instanceof MonitoringArtifactInfo); } @Test - public void testGetVesEvent() { - ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); + void testGetVesEvent() { + final ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); setInternals(uploadInfo); - - assertThat(uploadInfo.getVesEvent(), isA(MonitoringArtifactInfo.class)); + Assertions.assertTrue(uploadInfo.getVesEvent() instanceof MonitoringArtifactInfo); } @Test - public void testSetMonitoringArtifactFile() { - ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); + void testSetMonitoringArtifactFile() { + final ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); uploadInfo.setMonitoringArtifactFile(MonitoringUploadType.SNMP_POLL, new MonitoringArtifactInfo()); - - assertThat(getInternal(uploadInfo).containsKey(MonitoringUploadType.SNMP_POLL), is(true)); - } - - private Map<MonitoringUploadType, MonitoringArtifactInfo> getInternal(ComponentMonitoringUploadInfo componentMonitoringUploadInfo) { - return Deencapsulation.getField(componentMonitoringUploadInfo, "infoByType"); + Assertions.assertTrue(uploadInfo.getSnmpPoll() instanceof MonitoringArtifactInfo); } - private void setInternals(ComponentMonitoringUploadInfo componentMonitoringUploadInfo) { - Map<MonitoringUploadType, MonitoringArtifactInfo> infoMap = new HashMap<>(); - infoMap.put(MonitoringUploadType.SNMP_POLL, new MonitoringArtifactInfo()); - infoMap.put(MonitoringUploadType.SNMP_TRAP, new MonitoringArtifactInfo()); - infoMap.put(MonitoringUploadType.VES_EVENTS, new MonitoringArtifactInfo()); - Deencapsulation.setField(componentMonitoringUploadInfo, "infoByType", infoMap); + private void setInternals(final ComponentMonitoringUploadInfo componentMonitoringUploadInfo) { + componentMonitoringUploadInfo.setMonitoringArtifactFile(MonitoringUploadType.SNMP_POLL, new MonitoringArtifactInfo()); + componentMonitoringUploadInfo.setMonitoringArtifactFile(MonitoringUploadType.SNMP_TRAP, new MonitoringArtifactInfo()); + componentMonitoringUploadInfo.setMonitoringArtifactFile(MonitoringUploadType.VES_EVENTS, new MonitoringArtifactInfo()); } -}
\ No newline at end of file +} |