InMemoryFactory { public URL createInMemoryResource(String resource) throws MalformedURLException { String content = resource.replace('\\', '/'); return url(content); } InMemoryFactory(); URL createInMemoryClass(Class<?> claSs); URL createInMemoryResource(String resource);  }
@Test public void testCreateInMemoryResource() { try { String resource = "data/stuf/content.properties"; URL createInMemoryResource = underTest.createInMemoryResource(resource); assertThat(createInMemoryResource).isNotNull(); assertThat(createInMemoryResource.toString()).isEqualTo("inmemory: assertThat(createInMemoryResource.getHost()).isEqualTo("localhost"); assertThat(createInMemoryResource.getPath()).isEqualTo("/" + resource); } catch (MalformedURLException e) { fail("No exception should occu"); } }
@Test public void testCreateInMemoryResource2() { try { String resource = "data\\stuf\\content.properties"; String expected = "data/stuf/content.properties"; URL createInMemoryResource = underTest.createInMemoryResource(resource); assertThat(createInMemoryResource).isNotNull(); assertThat(createInMemoryResource.toString()).isEqualTo("inmemory: } catch (MalformedURLException e) { fail("No exception should occu"); } }
@Test() public void testCreateInMemoryResourceError() { try { String resource = "data\\stuf\\content.properties"; URL createInMemoryResource = underTest.createInMemoryResource(resource); createInMemoryResource.toExternalForm(); } catch (MalformedURLException e) { fail("No exception should occu"); } }