@Test void testWhenTerminalPermissionIsNullThenCRLNotInitialized() throws Exception { tempDirectory = JAVA_IO_TMPDIR + "-" + (int)(Math.random() * 1000000); Files.createDirectory(Paths.get(tempDirectory)); log.trace("Generated random temp dir: {}", tempDirectory); Path resourceDirectory = Paths.get("src", "test", "resources"); File source = new File(resourceDirectory + "/POSeIDAS.xml"); File dest = new File(tempDirectory + "/POSeIDAS.xml"); Files.copy(source.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING); System.setProperty("spring.config.additional-location", Paths.get(tempDirectory).toString()); startupListener = new StartupListener(facade, timer, cvcTlsCheck); startupListener.onApplicationEvent(webServerInitializedEvent); Mockito.verify(timer, Mockito.times(1)).renewMasterDefectList(); Assertions.assertThrows(IllegalStateException.class, CertificationRevocationListImpl::getInstance); Mockito.verify(cvcTlsCheck, Mockito.times(1)).check(); }
@EventListener public void onApplicationEvent(WebServerInitializedEvent event) { initCRL(); cvcTlsCheck.check(); }
StartupListener { @EventListener public void onApplicationEvent(WebServerInitializedEvent event) { initCRL(); cvcTlsCheck.check(); } }
StartupListener { @EventListener public void onApplicationEvent(WebServerInitializedEvent event) { initCRL(); cvcTlsCheck.check(); } StartupListener(TerminalPermissionAO facade, ApplicationTimer timer, CvcTlsCheck cvcTlsCheck); }
StartupListener { @EventListener public void onApplicationEvent(WebServerInitializedEvent event) { initCRL(); cvcTlsCheck.check(); } StartupListener(TerminalPermissionAO facade, ApplicationTimer timer, CvcTlsCheck cvcTlsCheck); @EventListener void onApplicationEvent(WebServerInitializedEvent event); }
StartupListener { @EventListener public void onApplicationEvent(WebServerInitializedEvent event) { initCRL(); cvcTlsCheck.check(); } StartupListener(TerminalPermissionAO facade, ApplicationTimer timer, CvcTlsCheck cvcTlsCheck); @EventListener void onApplicationEvent(WebServerInitializedEvent event);  }