@Test public void shouldCreateWithViewArtifact() throws Exception { String artifact = "/WEB-INF/pages/page.xhtml"; ViewArtifact viewArtifact = new ViewArtifact(artifact); FacesView view = new FacesView(viewArtifact); assertThat(view.getUrl(), is(artifact)); }
@Test public void shouldNotSetNullUrl() throws Exception { FacesView view = new FacesView(); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("URL must not be empty"); view.setUrl(null); }
@Test public void shouldRenderRemovingBindingResults() throws Exception { FacesView view = new FacesView(); Map<String, Object> model = new HashMap<String, Object>(); model.put("key", "value"); model.put("binding", mock(BindingResult.class)); view.renderMergedOutputModel(model, this.request, this.response); verify(this.springFacesContext).render(eq(view), this.modelCaptor.capture()); assertThat(this.modelCaptor.getValue().size(), is(1)); assertThat(this.modelCaptor.getValue().get("key"), is((Object) "value")); }
@Test public void shouldCreateWithUrl() throws Exception { String url = "http://localhost:8080"; FacesView view = new FacesView(url); assertThat(view.getUrl(), is(url)); }
@Test public void shouldGetViewArtifactFromUrl() throws Exception { FacesView view = new FacesView(); view.setUrl("artifact"); assertThat(view.getViewArtifact(), is(equalTo(new ViewArtifact("artifact")))); }