summaryrefslogtreecommitdiffstats
path: root/common-be
diff options
context:
space:
mode:
authorRodrigo Lima <rodrigo.lima@yoppworks.com>2020-04-29 15:39:56 -0400
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-04-30 14:00:18 +0000
commit7dec12b47ec34baec6d31dac3f2961e90e721632 (patch)
tree6f978a03233352838f70dc8bcf251fb0facd539e /common-be
parentd70091c786840042e7b56718115d1200410d9aed (diff)
Remove mockito from TypeUtilsTest
- Remove the use of mockito verify from TypeUtilsTest Issue-ID: SDC-2993 Signed-off-by: Rodrigo Lima <rodrigo.lima@yoppworks.com> Change-Id: I42c9c972cead10afaa3ec299624cf3d26e4d04db
Diffstat (limited to 'common-be')
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/utils/TypeUtilsTest.java26
1 files changed, 15 insertions, 11 deletions
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/utils/TypeUtilsTest.java b/common-be/src/test/java/org/openecomp/sdc/be/utils/TypeUtilsTest.java
index 2f6ddf92e8..182eede473 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/utils/TypeUtilsTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/utils/TypeUtilsTest.java
@@ -22,37 +22,41 @@
package org.openecomp.sdc.be.utils;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum;
import java.util.HashMap;
import java.util.Map;
-import java.util.function.Consumer;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
-@RunWith(MockitoJUnitRunner.class)
public class TypeUtilsTest {
private static final String ANY_GROUP = "anyGroup";
- @SuppressWarnings("unchecked")
- private Consumer<String> anyConsumer = (Consumer<String>) Mockito.spy(Consumer.class);
+ private class DummyClass {
+ private String field;
+
+ public void setField(String field) { this.field = field; }
+ public String getField() { return this.field; }
+ }
@Test
public void testSetFieldShouldConsumeForJSONContainingParam() {
+ DummyClass dummyObject = new DummyClass();
Map<String, Object> toscaJson = new HashMap<>();
toscaJson.put(ToscaTagNamesEnum.GROUPS.getElementName(), ANY_GROUP);
- TypeUtils.setField(toscaJson, ToscaTagNamesEnum.GROUPS, anyConsumer);
- Mockito.verify(anyConsumer).accept(ANY_GROUP);
+ TypeUtils.setField(toscaJson, ToscaTagNamesEnum.GROUPS, dummyObject::setField);
+ assertEquals(ANY_GROUP, dummyObject.getField());
}
@Test
public void testSetFieldShouldDoNothingForJSONNotContainingParam() {
+ DummyClass dummyObject = new DummyClass();
Map<String, Object> toscaJson = new HashMap<>();
toscaJson.put(ToscaTagNamesEnum.GROUPS.getElementName(), ANY_GROUP);
- TypeUtils.setField(toscaJson, ToscaTagNamesEnum.INPUTS, anyConsumer);
- Mockito.verifyZeroInteractions(anyConsumer);
+ TypeUtils.setField(toscaJson, ToscaTagNamesEnum.INPUTS, dummyObject::setField);
+ assertNull(dummyObject.getField());
}
} \ No newline at end of file