Skip to content

Commit

Permalink
fixing executeMethod and messages tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Turini committed Feb 21, 2015
1 parent c41f284 commit c92a1a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
import br.com.caelum.vraptor.interceptor.DogAlike;
import br.com.caelum.vraptor.validator.Message;
import br.com.caelum.vraptor.validator.Messages;
import br.com.caelum.vraptor.validator.ValidationFailedException;
import br.com.caelum.vraptor.validator.ValidationException;
import br.com.caelum.vraptor.validator.ValidationFailedException;
import br.com.caelum.vraptor.validator.Validator;

import org.junit.Before;
Expand Down Expand Up @@ -128,12 +130,12 @@ public void shouldBeOkIfThereIsValidationErrorsAndYouSpecifiedWhereToGo() throws

@Test
public void shouldThrowExceptionIfYouHaventSpecifiedWhereToGoOnValidationError() throws Exception {
exception.expect(InterceptionException.class);
exception.expect(ValidationFailedException.class);

Method didntSpecifyWhereToGo = AnyController.class.getMethod("didntSpecifyWhereToGo");
final ControllerMethod method = DefaultControllerMethod.instanceFor(AnyController.class, didntSpecifyWhereToGo);
final AnyController controller = new AnyController(validator);
doThrow(new IllegalStateException()).when(messages).assertAbsenceOfErrors();
doThrow(new ValidationFailedException("")).when(messages).assertAbsenceOfErrors();
when(methodInfo.getParametersValues()).thenReturn(new Object[0]);

observer.execute(new InterceptorsExecuted(method, controller));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void setUp() {

@Test
public void shouldThrowExceptionIfMessagesHasUnhandledErrors() {
exception.expect(IllegalStateException.class);
exception.expect(ValidationFailedException.class);
exception.expectMessage(containsString("There are validation errors and you forgot to specify where to go."));

messages.add(new SimpleMessage("Test", "Test message"));
Expand Down

0 comments on commit c92a1a3

Please sign in to comment.