@Test public void discoverApplicationsShouldThrowApplicationLoadExceptionWhenIOExceptionOccurs() throws IOException { givenExistingResourceFolder(); IOException ioException = new IOException(); given(resourceLoader.getResources(anyString())).willThrow(ioException); Throwable thrown = catchThrowable(() -> applicationDiscovery.discoverApplications()); assertThat(thrown) .isInstanceOf(AppliationLoadException.class) .hasCause(ioException); }
public List<Resource> discoverApplications() { List<Resource> resources = new ArrayList<>(); Resource resource = resourceLoader.getResource(applicationsLocation); if (resource.exists()) { try { resources = Arrays.asList(resourceLoader.getResources(applicationsLocation + "**.zip")); } catch (IOException e) { throw new AppliationLoadException("Unable to load application resources", e); } } return resources; }
ApplicationDiscovery { public List<Resource> discoverApplications() { List<Resource> resources = new ArrayList<>(); Resource resource = resourceLoader.getResource(applicationsLocation); if (resource.exists()) { try { resources = Arrays.asList(resourceLoader.getResources(applicationsLocation + "**.zip")); } catch (IOException e) { throw new AppliationLoadException("Unable to load application resources", e); } } return resources; } }
ApplicationDiscovery { public List<Resource> discoverApplications() { List<Resource> resources = new ArrayList<>(); Resource resource = resourceLoader.getResource(applicationsLocation); if (resource.exists()) { try { resources = Arrays.asList(resourceLoader.getResources(applicationsLocation + "**.zip")); } catch (IOException e) { throw new AppliationLoadException("Unable to load application resources", e); } } return resources; } ApplicationDiscovery(ResourcePatternResolver resourceLoader,
                                String applicationsLocation); }
ApplicationDiscovery { public List<Resource> discoverApplications() { List<Resource> resources = new ArrayList<>(); Resource resource = resourceLoader.getResource(applicationsLocation); if (resource.exists()) { try { resources = Arrays.asList(resourceLoader.getResources(applicationsLocation + "**.zip")); } catch (IOException e) { throw new AppliationLoadException("Unable to load application resources", e); } } return resources; } ApplicationDiscovery(ResourcePatternResolver resourceLoader,
                                String applicationsLocation); List<Resource> discoverApplications(); }
ApplicationDiscovery { public List<Resource> discoverApplications() { List<Resource> resources = new ArrayList<>(); Resource resource = resourceLoader.getResource(applicationsLocation); if (resource.exists()) { try { resources = Arrays.asList(resourceLoader.getResources(applicationsLocation + "**.zip")); } catch (IOException e) { throw new AppliationLoadException("Unable to load application resources", e); } } return resources; } ApplicationDiscovery(ResourcePatternResolver resourceLoader,
                                String applicationsLocation); List<Resource> discoverApplications();  }