+ @Test
+ public void whenTheConfigurationFits() throws IOException, ServiceException {
+
+ appConfigUnderTest = spy(ApplicationConfig.class);
+ appConfigUnderTest.systemEnvironment = new Properties();
+ // When
+ doReturn(getCorrectJson()).when(appConfigUnderTest).createInputStream(any());
+ doReturn("fileName").when(appConfigUnderTest).getLocalConfigurationFilePath();
+ appConfigUnderTest.initialize();
+
+ // Then
+ verify(appConfigUnderTest, times(1)).loadConfigurationFromFile();
+
+ Iterable<RicConfig> ricConfigs = appConfigUnderTest.getRicConfigs();
+ RicConfig ricConfig = ricConfigs.iterator().next();
+ assertThat(ricConfigs).isNotNull();
+ assertThat(ricConfig).isEqualTo(CORRECT_RIC_CONIFG);
+ }
+
+ @Test
+ public void whenFileIsExistsButJsonIsIncorrect() throws IOException, ServiceException {
+
+ appConfigUnderTest = spy(ApplicationConfig.class);
+ appConfigUnderTest.systemEnvironment = new Properties();
+
+ // When
+ doReturn(getIncorrectJson()).when(appConfigUnderTest).createInputStream(any());
+ doReturn("fileName").when(appConfigUnderTest).getLocalConfigurationFilePath();
+ appConfigUnderTest.loadConfigurationFromFile();
+
+ // Then
+ verify(appConfigUnderTest, times(1)).loadConfigurationFromFile();
+ Assertions.assertEquals(0, appConfigUnderTest.getRicConfigs().size());
+ }
+