X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Fresources%2FAAFAuthenticationFilterTest.java;h=53c8021934c6f53ab4b6bf4d3bac0bbf0bc77694;hb=refs%2Fchanges%2F37%2F85037%2F1;hp=d5ae5fd4e9bc3013aadefd63ac6e0d94de31d7d5;hpb=0654d98f69b80b8d932dd33a5dcc56dbecc6a64e;p=dmaap%2Fdbcapi.git diff --git a/src/test/java/org/onap/dmaap/dbcapi/resources/AAFAuthenticationFilterTest.java b/src/test/java/org/onap/dmaap/dbcapi/resources/AAFAuthenticationFilterTest.java index d5ae5fd..53c8021 100644 --- a/src/test/java/org/onap/dmaap/dbcapi/resources/AAFAuthenticationFilterTest.java +++ b/src/test/java/org/onap/dmaap/dbcapi/resources/AAFAuthenticationFilterTest.java @@ -118,10 +118,25 @@ public class AAFAuthenticationFilterTest { } @Test - public void init_shouldInitializeCADI_whenAafIsUsed_andCadiPropertiesSet() throws Exception { + public void init_shouldFail_whenAafIsUsed_andInvalidCadiPropertiesSet() throws Exception { //given + String invalidFilePath = "src/test/resources/notExisting.properties"; doReturn("true").when(dmaapConfig).getProperty(eq(AAFAuthenticationFilter.AAF_AUTHN_FLAG), anyString()); - doReturn("cadi.properties").when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES); + doReturn(invalidFilePath).when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES); + + //then + thrown.expect(ServletException.class); + thrown.expectMessage("Could not load CADI properties file: "+invalidFilePath); + + //when + filter.init(filterConfig); + } + + @Test + public void init_shouldInitializeCADI_whenAafIsUsed_andValidCadiPropertiesSet() throws Exception { + //given + doReturn("true").when(dmaapConfig).getProperty(eq(AAFAuthenticationFilter.AAF_AUTHN_FLAG), anyString()); + doReturn("src/test/resources/cadi.properties").when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES); //when filter.init(filterConfig); @@ -170,7 +185,7 @@ public class AAFAuthenticationFilterTest { private void initCADIFilter() throws Exception{ doReturn("true").when(dmaapConfig).getProperty(eq(AAFAuthenticationFilter.AAF_AUTHN_FLAG), anyString()); - doReturn("cadi.properties").when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES); + doReturn("src/test/resources/cadi.properties").when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES); filter.init(filterConfig); filter.setCadiFilter(cadiFilterMock); }