use of ninja.validation.ValidationImpl in project ninja by ninjaframework.
the class BodyParserEnginePostTest method setUp.
@Before
public void setUp() {
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(NinjaProperties.class).toInstance(new NinjaPropertiesImpl(NinjaMode.test));
Multibinder<ParamParser> parsersBinder = Multibinder.newSetBinder(binder(), ParamParser.class);
parsersBinder.addBinding().to(NeedingInjectionParamParser.class);
}
});
validation = new ValidationImpl();
Mockito.when(this.context.getValidation()).thenReturn(this.validation);
bodyParserEnginePost = injector.getInstance(BodyParserEnginePost.class);
}
use of ninja.validation.ValidationImpl in project ninja by ninjaframework.
the class RouterImplTest method routeForSpecificInstanceMethodReferenceWithAnnotations.
@Test
public void routeForSpecificInstanceMethodReferenceWithAnnotations() {
Context context = mock(Context.class);
when(context.getParameter("status")).thenReturn("207");
when(context.getValidation()).thenReturn(new ValidationImpl());
Route route = router.getRouteFor("GET", "/specific_instance_method_ref_annotations");
Result result = route.getFilterChain().next(context);
// message set on specific instance
assertThat(result.getStatusCode(), is(207));
assertThat(result.getRenderable(), is("Hi!"));
}
use of ninja.validation.ValidationImpl in project ninja by ninjaframework.
the class RouterImplTest method routeForAnonymoumsClassInstanceWithAnnotations.
@Test
public void routeForAnonymoumsClassInstanceWithAnnotations() {
Context context = mock(Context.class);
when(context.getParameter("status")).thenReturn("205");
when(context.getValidation()).thenReturn(new ValidationImpl());
Route route = router.getRouteFor("GET", "/anonymous_class_annotations");
Result result = route.getFilterChain().next(context);
assertThat(result.getStatusCode(), is(205));
}
Aggregations