Package org.springframework.springfaces.message

Examples of org.springframework.springfaces.message.NoSuchObjectMessageException


  @Test
  public void shouldNotHandleMissingMessage() throws Exception {
    this.handler.setMessageSource(this.messageSource);
    given(this.messageSource.getMessage(this.exception, null, null)).willThrow(
        new NoSuchObjectMessageException(this.exception, null));
    boolean result = this.handler.handle(this.exception, this.event);
    assertThat(result, is(false));
    verify(this.facesContext, never()).addMessage(anyString(), isA(FacesMessage.class));
  }
View Full Code Here


  @Test
  public void shouldIgnoreNoSuchObjectMessageException() throws Exception {
    ObjectMessageSource messageSource = mock(ObjectMessageSource.class);
    given(messageSource.getMessage(SampleEnum.ONE, null, this.locale)).willThrow(
        new NoSuchObjectMessageException(SampleEnum.ONE, this.locale));
    UIComponent parent = mockParent(UISelectMany.class);
    this.selectItems.setParent(parent);
    this.selectItems.setValue(Collections.singleton(SampleEnum.ONE));
    this.selectItems.setMessageSource(messageSource);
    SelectItem actual = this.selectItems.getSelectItems().get(0);
View Full Code Here

    MessageSourceMap map = new TestMessageSourceMap(objectMessageSource);
    ObjectResolvable resolvable = new ObjectResolvable();
    String expected = "test";
    given(objectMessageSource.getMessage((Object) eq("y"), emptyObjectArray(), nullLocale())).willReturn("y2");
    given(objectMessageSource.getMessage((Object) eq("z"), emptyObjectArray(), nullLocale())).willThrow(
        new NoSuchObjectMessageException("z", null));
    given(objectMessageSource.getMessage(eq(resolvable), eq(new Object[] { "y2", "z" }), nullLocale())).willReturn(
        expected);
    String actual = map.get(resolvable, "y", "z").toString();
    assertThat(actual, is(equalTo(expected)));
  }
View Full Code Here

TOP

Related Classes of org.springframework.springfaces.message.NoSuchObjectMessageException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.