use of com.tvd12.ezyhttp.server.core.resources.ResourceLoader in project ezyhttp by youngmonkeys.
the class ResourceLoaderTest method loadFromJarTest.
@Test
public void loadFromJarTest() {
// given
ResourceLoader sut = new ResourceLoader();
// when
List<String> listResources = sut.listResources("com/tvd12", Sets.newHashSet("^static/css/.+"));
// then
Asserts.assertEquals(0, listResources.size());
}
use of com.tvd12.ezyhttp.server.core.resources.ResourceLoader in project ezyhttp by youngmonkeys.
the class ResourceLoaderTest method loadFromFolder.
@Test
public void loadFromFolder() {
// given
ResourceLoader sut = new ResourceLoader();
// when
List<String> listResources = sut.listResources("src/main/resources");
// then
Asserts.assertEquals(Objects.requireNonNull(new File("src/main/resources").list()).length, listResources.size());
}
use of com.tvd12.ezyhttp.server.core.resources.ResourceLoader in project ezyhttp by youngmonkeys.
the class ResourceLoaderTest method urlPathEmpty.
@Test
public void urlPathEmpty() {
// given
ResourceLoader sut = new ResourceLoader() {
@Override
protected Set<URL> getResourceURLs(String resource) {
try {
return Sets.newHashSet(new URL("http://locahost"));
} catch (MalformedURLException e) {
e.printStackTrace();
throw new IllegalArgumentException(e);
}
}
};
// when
List<String> listResources = sut.listResources("application.yaml");
// then
Asserts.assertTrue(listResources.isEmpty());
}
use of com.tvd12.ezyhttp.server.core.resources.ResourceLoader in project ezyhttp by youngmonkeys.
the class ResourceLoaderTest method getJarFileNullDueToException.
@Test
public void getJarFileNullDueToException() {
// given
String filePath = "#$%^&*";
ResourceLoader sut = new ResourceLoader();
// when
JarFile actual = MethodInvoker.create().object(sut).method("getJarFile").param(String.class, filePath).invoke(JarFile.class);
// then
Asserts.assertNull(actual);
}
use of com.tvd12.ezyhttp.server.core.resources.ResourceLoader in project ezyhttp by youngmonkeys.
the class ResourceLoaderTest method addURLsToSetURLsIsNull.
@Test
public void addURLsToSetURLsIsNull() {
// given
ResourceLoader sut = new ResourceLoader();
Set<URL> answer = new HashSet<>();
// when
MethodInvoker.create().object(sut).method("addURLsToSet").param(Set.class, answer).param(Enumeration.class, null).invoke();
// then
Asserts.assertTrue(answer.isEmpty());
}
Aggregations