@Test public void the_message_list_does_not_contain_messages_that_belong_to_a_component() { final FacesMessage componentMessage = new FacesMessage(SEVERITY_INFO, "", ""); prepareExpectedMessages(emptyList()); getCurrentInstance().addMessage("foo", componentMessage); List<FacesMessage> facesMessages = new BootstrappedMessages().getFacesMessages(); assertThat(facesMessages).isEqualTo(emptyList()); new Verifications() { { getCurrentInstance().getMessages("foo"); times = 0; } }; }
public List<FacesMessage> getFacesMessages() { List<FacesMessage> messageList = new ArrayList<>(); Iterator<FacesMessage> messageItr = getFacesContext().getMessages(null); while (messageItr.hasNext()) { FacesMessage message = messageItr.next(); messageList.add(message); messageItr.remove(); } return messageList; }
BootstrappedMessages extends UINamingContainer { public List<FacesMessage> getFacesMessages() { List<FacesMessage> messageList = new ArrayList<>(); Iterator<FacesMessage> messageItr = getFacesContext().getMessages(null); while (messageItr.hasNext()) { FacesMessage message = messageItr.next(); messageList.add(message); messageItr.remove(); } return messageList; } }
BootstrappedMessages extends UINamingContainer { public List<FacesMessage> getFacesMessages() { List<FacesMessage> messageList = new ArrayList<>(); Iterator<FacesMessage> messageItr = getFacesContext().getMessages(null); while (messageItr.hasNext()) { FacesMessage message = messageItr.next(); messageList.add(message); messageItr.remove(); } return messageList; }  }
BootstrappedMessages extends UINamingContainer { public List<FacesMessage> getFacesMessages() { List<FacesMessage> messageList = new ArrayList<>(); Iterator<FacesMessage> messageItr = getFacesContext().getMessages(null); while (messageItr.hasNext()) { FacesMessage message = messageItr.next(); messageList.add(message); messageItr.remove(); } return messageList; }  List<FacesMessage> getFacesMessages(); }
BootstrappedMessages extends UINamingContainer { public List<FacesMessage> getFacesMessages() { List<FacesMessage> messageList = new ArrayList<>(); Iterator<FacesMessage> messageItr = getFacesContext().getMessages(null); while (messageItr.hasNext()) { FacesMessage message = messageItr.next(); messageList.add(message); messageItr.remove(); } return messageList; }  List<FacesMessage> getFacesMessages();  }