Search in sources :

Example 1 with EzyPrototypeFactory

use of com.tvd12.ezyfox.bean.EzyPrototypeFactory in project ezyfox-server by youngmonkeys.

the class EzyUserRequestPrototypeControllerTest method test.

@Test
public void test() {
    // given
    EzyPrototypeFactory prototypeFactory = mock(EzyPrototypeFactory.class);
    when(prototypeFactory.getSuppliers(EzyRequestListener.class)).thenReturn(Collections.emptyList());
    EzyBeanContext beanContext = mock(EzyBeanContext.class);
    when(beanContext.getPrototypeFactory()).thenReturn(prototypeFactory);
    InternalController sut = new InternalController.Builder().beanContext(beanContext).build();
    // when
    EzyAppContext appContext = mock(EzyAppContext.class);
    EzyUserRequestEvent event = mock(EzyUserRequestEvent.class);
    String cmd = RandomUtil.randomShortAlphabetString();
    EzyHandler handler = mock(EzyHandler.class);
    sut.postHandle(appContext, event, cmd, handler);
    // then
    verify(beanContext, times(1)).getPrototypeFactory();
    verify(beanContext, times(1)).getSingleton("unmarshaller", EzyUnmarshaller.class);
}
Also used : EzyPrototypeFactory(com.tvd12.ezyfox.bean.EzyPrototypeFactory) EzyBeanContext(com.tvd12.ezyfox.bean.EzyBeanContext) EzyAppContext(com.tvd12.ezyfoxserver.context.EzyAppContext) EzyUserRequestEvent(com.tvd12.ezyfoxserver.event.EzyUserRequestEvent) EzyHandler(com.tvd12.ezyfox.function.EzyHandler) Test(org.testng.annotations.Test)

Aggregations

EzyBeanContext (com.tvd12.ezyfox.bean.EzyBeanContext)1 EzyPrototypeFactory (com.tvd12.ezyfox.bean.EzyPrototypeFactory)1 EzyHandler (com.tvd12.ezyfox.function.EzyHandler)1 EzyAppContext (com.tvd12.ezyfoxserver.context.EzyAppContext)1 EzyUserRequestEvent (com.tvd12.ezyfoxserver.event.EzyUserRequestEvent)1 Test (org.testng.annotations.Test)1