summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/test')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/LoggerControllerTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/LoggerControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/LoggerControllerTest.java
index fdc0f44d1..f0d840929 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/LoggerControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/LoggerControllerTest.java
@@ -108,4 +108,19 @@ public class LoggerControllerTest {
.andExpect(content().string(""))
.andExpect(status().isOk());
}
+
+ @Test
+ public void shouldReturnEmptyString_whenDebugLogFileIsEmpty() throws Exception {
+ List<Role> list = ImmutableList.of(new Role(EcompRole.READ, "subName1", "servType1", "tenant1"));
+
+ given(provider.getUserRoles(argThat(req -> req.getRequestedSessionId().equals("id1")))).willReturn(list);
+ given(provider.userPermissionIsReadLogs(list)).willReturn(true);
+ given(creator.getLogfilePath("debug")).willReturn(EMPTY_LOG_PATH);
+
+ mockMvc.perform(get("/logger/debug")
+ .with(req -> {req.setRequestedSessionId("id1");
+ return req;}))
+ .andExpect(content().string(""))
+ .andExpect(status().isOk());
+ }
}