lundi 30 mai 2016

How to test FacesContext showing a message with JUnit

abort()-Method:

public void abort() {
    LOG.info("some-text");
    warning("some-text");
}

warning()-Method:

 public void warning(String message) {
    FacesContext.getCurrentInstance()
.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "INFO:", message));
}

I want to write a Test-Case for abort wich is just verifying that nothing has changed and a second Test-Case which is verifying that warning() is working. I´m knowing this little two methods doesn´t need a Unit-Test but I want to know if it´s possible. UI-Test for showing the p:message is working well but I want to check the Caption, Typ and Message by Unittest before because it´s running much faster.

Aucun commentaire:

Enregistrer un commentaire