- doReturn("true").when(dmaapConfig).getProperty(eq(AAFAuthenticationFilter.AAF_AUTHN_FLAG), anyString());
- doReturn("cadi.properties").when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES);
+ String invalidFilePath = "src/test/resources/notExisting.properties";
+ doReturn("true").when(dmaapConfig).getProperty(eq(AAFAuthenticationFilter.CADI_AUTHN_FLAG), anyString());
+ 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);
+ }
+
+ /*
+ * See https://jira.onap.org/browse/DMAAP-1361 for why this is commented out
+ @Test
+ public void init_shouldInitializeCADI_whenAafIsUsed_andValidCadiPropertiesSet() throws Exception {
+ //given
+ doReturn("true").when(dmaapConfig).getProperty(eq(AAFAuthenticationFilter.CADI_AUTHN_FLAG), anyString());
+ doReturn("src/test/resources/cadi.properties").when(dmaapConfig).getProperty(AAFAuthenticationFilter.CADI_PROPERTIES);