Search in sources :

Example 1 with EzyPropertyFetcher

use of com.tvd12.ezyfox.bean.EzyPropertyFetcher in project ezyhttp by youngmonkeys.

the class ResourceResolversTest method testWithNullPattern.

@Test
public void testWithNullPattern() {
    // given
    EzyPropertyFetcher propertyFetcher = mock(EzyPropertyFetcher.class);
    when(propertyFetcher.getProperty(RESOURCE_ENABLE, boolean.class, false)).thenReturn(true);
    when(propertyFetcher.getProperty(RESOURCE_LOCATIONS, String[].class)).thenReturn(new String[] { "static" });
    // when
    ResourceResolver resourceResolver = ResourceResolvers.createResourdeResolver(propertyFetcher);
    // then
    assert resourceResolver != null;
    Asserts.assertEquals(4, resourceResolver.getResources().size());
}
Also used : ResourceResolver(com.tvd12.ezyhttp.server.core.resources.ResourceResolver) EzyPropertyFetcher(com.tvd12.ezyfox.bean.EzyPropertyFetcher) Test(org.testng.annotations.Test)

Example 2 with EzyPropertyFetcher

use of com.tvd12.ezyfox.bean.EzyPropertyFetcher in project ezyhttp by youngmonkeys.

the class ResourceResolversTest method test.

@Test
public void test() {
    // given
    EzyPropertyFetcher propertyFetcher = mock(EzyPropertyFetcher.class);
    when(propertyFetcher.getProperty(RESOURCE_ENABLE, boolean.class, false)).thenReturn(true);
    when(propertyFetcher.getProperty(RESOURCE_LOCATIONS, String[].class)).thenReturn(new String[] { "static" });
    when(propertyFetcher.getProperty(RESOURCE_PATTERN, String.class)).thenReturn("static/.+");
    // when
    ResourceResolver resourceResolver = ResourceResolvers.createResourdeResolver(propertyFetcher);
    // then
    assert resourceResolver != null;
    Asserts.assertEquals(4, resourceResolver.getResources().size());
}
Also used : ResourceResolver(com.tvd12.ezyhttp.server.core.resources.ResourceResolver) EzyPropertyFetcher(com.tvd12.ezyfox.bean.EzyPropertyFetcher) Test(org.testng.annotations.Test)

Aggregations

EzyPropertyFetcher (com.tvd12.ezyfox.bean.EzyPropertyFetcher)2 ResourceResolver (com.tvd12.ezyhttp.server.core.resources.ResourceResolver)2 Test (org.testng.annotations.Test)2