public void shouldAddFacesMessageOnMissingMessageWhenNotInProduction() throws Exception {
given(this.viewRoot.getViewId()).willReturn("/WEB-INF/pages/example/page.xhtml");
given(this.facesContext.isProjectStage(ProjectStage.Production)).willReturn(false);
MessageSourceMap messageSourceMap = callSetParent();
given(this.applicationContext.getMessage((MessageSourceResolvable) any(), (Locale) any())).willThrow(
new NoSuchMessageException("test"));
messageSourceMap.get("test").toString();
verify(this.facesContext).addMessage(anyString(), this.messageCaptor.capture());
assertThat(this.messageCaptor.getValue().getDetail(), is("No message found under code 'test' for locale '"
+ Locale.getDefault().toString() + "'."));
}