Search in sources :

Example 1 with EzyContext

use of com.tvd12.ezyfoxserver.context.EzyContext in project ezyfox-server by youngmonkeys.

the class EzyAbstractObjectResponseTest method exclude2Times.

@Test
public void exclude2Times() {
    // given
    EzyContext context = mock(EzyContext.class);
    EzyMarshaller marshaller = mock(EzyMarshaller.class);
    String excludeKey1 = RandomUtil.randomShortAlphabetString();
    String excludeKey2 = RandomUtil.randomShortAlphabetString();
    // when
    EzyObjectResponse sut = new InternalObjectResponse(context, marshaller).exclude(excludeKey1).exclude(excludeKey2);
    // then
    Asserts.assertEquals(FieldUtil.getFieldValue(sut, "excludeParamKeys"), Sets.newHashSet(excludeKey1, excludeKey2));
}
Also used : EzyMarshaller(com.tvd12.ezyfox.binding.EzyMarshaller) EzyObjectResponse(com.tvd12.ezyfoxserver.support.command.EzyObjectResponse) EzyContext(com.tvd12.ezyfoxserver.context.EzyContext) Test(org.testng.annotations.Test)

Example 2 with EzyContext

use of com.tvd12.ezyfoxserver.context.EzyContext in project ezyfox-server by youngmonkeys.

the class EzyUserRequestInterceptorTest method preHandleTest.

@Test
public void preHandleTest() {
    // given
    EzyUserRequestInterceptor<EzyContext> sut = new EzyUserRequestInterceptor<EzyContext>() {
    };
    // when
    // then
    EzyContext context = mock(EzyContext.class);
    EzyUserSessionEvent event = mock(EzyUserSessionEvent.class);
    String command = RandomUtil.randomShortAlphabetString();
    String data = RandomUtil.randomShortAlphabetString();
    sut.preHandle(context, event, data, command);
    sut.postHandle(context, event, data, command);
    Exception e = new Exception("just test");
    sut.postHandle(context, event, data, command, e);
}
Also used : EzyUserSessionEvent(com.tvd12.ezyfoxserver.event.EzyUserSessionEvent) EzyContext(com.tvd12.ezyfoxserver.context.EzyContext) EzyUserRequestInterceptor(com.tvd12.ezyfoxserver.support.handler.EzyUserRequestInterceptor) Test(org.testng.annotations.Test)

Aggregations

EzyContext (com.tvd12.ezyfoxserver.context.EzyContext)2 Test (org.testng.annotations.Test)2 EzyMarshaller (com.tvd12.ezyfox.binding.EzyMarshaller)1 EzyUserSessionEvent (com.tvd12.ezyfoxserver.event.EzyUserSessionEvent)1 EzyObjectResponse (com.tvd12.ezyfoxserver.support.command.EzyObjectResponse)1 EzyUserRequestInterceptor (com.tvd12.ezyfoxserver.support.handler.EzyUserRequestInterceptor)1