+ private void initBundleContext() {
+ this.mockedServiceRegistration = mock(ServiceRegistration.class);
+ doNothing().when(mockedServiceRegistration).unregister();
+
+ RegisterServiceAnswer answer = new RegisterServiceAnswer();
+
+ doAnswer(answer).when(mockedContext).registerService(Matchers.any(String[].class),
+ any(Closeable.class), Matchers.<Dictionary<String, ?>>any());
+ doAnswer(answer).when(mockedContext).registerService(Matchers.<Class<Closeable>>any(), any(Closeable.class),
+ Matchers.<Dictionary<String, ?>>any());
+ }
+
+
+ public Collection<InputStream> getFilesAsInputStreams(List<String> paths) {
+ final Collection<InputStream> resources = new ArrayList<>();
+ List<String> failedToFind = new ArrayList<>();
+ for (String path : paths) {
+ InputStream resourceAsStream = getClass().getResourceAsStream(path);
+ if (resourceAsStream == null) {
+ failedToFind.add(path);
+ } else {
+ resources.add(resourceAsStream);
+ }
+ }
+ Assert.assertEquals("Some files were not found", Collections.<String>emptyList(), failedToFind);
+
+ return resources;
+ }
+