use of com.tvd12.ezyhttp.server.core.resources.ResourceLoader in project ezyhttp by youngmonkeys.
the class ResourceLoaderTest method listFileEmptyTest.
@Test
public void listFileEmptyTest() {
// given
File file = new File("unknow file");
ResourceLoader sut = new ResourceLoader();
// when
File[] actual = MethodInvoker.create().object(sut).method("listFile").param(File.class, file).invoke(File[].class);
// then
Asserts.assertZero(actual.length);
}
use of com.tvd12.ezyhttp.server.core.resources.ResourceLoader in project ezyhttp by youngmonkeys.
the class ResourceLoaderTest method isNotFileElement.
@Test
public void isNotFileElement() {
// given
String filePath = "file\\";
ResourceLoader sut = new ResourceLoader();
// when
boolean actual = MethodInvoker.create().object(sut).method("isFileElement").param(String.class, filePath).invoke(Boolean.class);
// then
Asserts.assertFalse(actual);
}
use of com.tvd12.ezyhttp.server.core.resources.ResourceLoader in project ezyhttp by youngmonkeys.
the class ResourceLoaderTest method urlNull.
@Test
public void urlNull() {
// given
ResourceLoader sut = new ResourceLoader();
// when
List<String> listResources = sut.listResources("not found");
// then
Asserts.assertTrue(listResources.isEmpty());
}
use of com.tvd12.ezyhttp.server.core.resources.ResourceLoader in project ezyhttp by youngmonkeys.
the class ResourceLoaderTest method regexTest.
@Test
public void regexTest() {
// given
ResourceLoader sut = new ResourceLoader();
// when
List<String> listResources = sut.listResources("static", Sets.newHashSet("^static/css/.+"));
// then
Asserts.assertEquals(2, listResources.size());
}
use of com.tvd12.ezyhttp.server.core.resources.ResourceLoader in project ezyhttp by youngmonkeys.
the class ResourceLoaderTest method addURLsToSetTest.
@Test
public void addURLsToSetTest() {
// given
ResourceLoader sut = new ResourceLoader();
Set<URL> answer = new HashSet<>();
Exception exception = new Exception("just test");
EzySupplier<Enumeration<URL>> supplier = () -> {
throw exception;
};
// when
MethodInvoker.create().object(sut).method("addURLsToSet").param(Set.class, answer).param(EzySupplier.class, supplier).invoke();
// then
Asserts.assertTrue(answer.isEmpty());
}
Aggregations