diff options
author | Varun Gudisena <vg411h@att.com> | 2017-10-04 00:30:46 -0500 |
---|---|---|
committer | Varun Gudisena <vg411h@att.com> | 2017-10-04 00:30:56 -0500 |
commit | e9adb1321b864d9ba6d1c8385206d2f1ac5b3a82 (patch) | |
tree | d4d4217119d2ae2af8c0b990163460d17737eb86 /src/test | |
parent | 628ae319ab0d982bc4d4f2b0725de2bcc03b40a5 (diff) |
Add unit test cases
Issue-Id: DMAAP-151
Change-Id: I9bf7c8925751ca7b326407875d0032ce321c5d49
Signed-off-by: Varun Gudisena <vg411h@att.com>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMapTest.java | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/src/test/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMapTest.java b/src/test/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMapTest.java index 5a4d5b5..df3695e 100644 --- a/src/test/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMapTest.java +++ b/src/test/java/com/att/nsa/dmaap/filemonitor/ServicePropertiesMapTest.java @@ -23,13 +23,30 @@ package com.att.nsa.dmaap.filemonitor; import static org.junit.Assert.*;
import java.io.File;
+import java.io.FileNotFoundException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.modules.junit4.PowerMockRunner;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RunWith(PowerMockRunner.class)
public class ServicePropertiesMapTest {
+ @InjectMocks
+ ServicePropertiesMap map;
+
+
@Before
public void setUp() throws Exception {
}
@@ -41,12 +58,9 @@ public class ServicePropertiesMapTest { @Test
public void testRefresh() {
- ServicePropertiesMap map = new ServicePropertiesMap();
-
try {
map.refresh(new File(":/file"));
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
@@ -54,15 +68,26 @@ public class ServicePropertiesMapTest { }
+ @Test()
+ public void testRefreshJsonFile() throws Exception {
+ Path resourceDirectory = Paths.get("src/test/resources");
+ map.refresh(new File(resourceDirectory+"\\"+"test.json"));
+ assertTrue(true);
+ }
+
@Test
- public void testGetProperty() {
+ public void testRefreshPropsFile() throws Exception {
+ Path resourceDirectory = Paths.get("src/test/resources");
+ map.refresh(new File(resourceDirectory+"\\"+"test.properties"));
+ assertTrue(true);
+ }
- ServicePropertiesMap map = new ServicePropertiesMap();
+ @Test
+ public void testGetProperty() {
try {
map.getProperty("filename", "propertykey");
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
@@ -72,12 +97,9 @@ public class ServicePropertiesMapTest { @Test
public void testGetProperties() {
- ServicePropertiesMap map = new ServicePropertiesMap();
-
try {
map.getProperties("filename");
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
@@ -88,12 +110,9 @@ public class ServicePropertiesMapTest { @Test
public void testIfNullThenEmpty() {
- ServicePropertiesMap map = new ServicePropertiesMap();
-
try {
map.getProperties("filename");
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
|