use of com.tvd12.ezyhttp.server.core.view.ViewContext in project ezyhttp by youngmonkeys.
the class ApplicationContextBuilderTest method buildViewContextViewContextNotNull.
@Test
public void buildViewContextViewContextNotNull() {
// given
EzyBeanContext beanContext = mock(EzyBeanContext.class);
ViewContext viewContext = mock(ViewContext.class);
when(beanContext.getSingleton(ViewContext.class)).thenReturn(viewContext);
EzySingletonFactory singletonFactory = mock(EzySingletonFactory.class);
when(beanContext.getSingletonFactory()).thenReturn(singletonFactory);
ApplicationContextBuilder sut = new ApplicationContextBuilder();
// when
ViewContext actual = MethodInvoker.create().object(sut).method("buildViewContext").param(EzyBeanContext.class, beanContext).invoke(ViewContext.class);
// then
Asserts.assertEquals(viewContext, actual);
verify(beanContext, times(1)).getSingleton(ViewContext.class);
verify(beanContext, times(1)).getSingletonFactory();
verify(singletonFactory, times(1)).addSingleton(viewContext);
}
Aggregations