### Question:
DestinationAndModel { protected UIComponent getComponent() { return this.component; } DestinationAndModel(NavigationOutcome navigationOutcome, PreRenderComponentEvent preRenderComponentEvent);  DestinationAndModel(NavigationOutcome navigationOutcome, ActionEvent actionEvent); Object getDestination(); Map<String, Object> getModel(FacesContext context, Map<String, List<String>> parameters,
			Map<String, Object> resolvedViewModel);  }### Answer:
@Test public void shouldAllowNullPreRenderComponentEvent() throws Exception { NavigationOutcome outcome = new NavigationOutcome(new Object()); DestinationAndModel dam = new DestinationAndModel(outcome, (PreRenderComponentEvent) null); assertThat(dam.getComponent(), is(nullValue())); }
@Test public void shouldObtainComponentFromPreRenderComponentEvent() throws Exception { NavigationOutcome outcome = new NavigationOutcome(new Object()); UIComponent component = mock(UIComponent.class); PreRenderComponentEvent preRenderComponentEvent = new PreRenderComponentEvent(component); DestinationAndModel dam = new DestinationAndModel(outcome, preRenderComponentEvent); assertThat(dam.getComponent(), is(sameInstance(component))); }
@Test public void shouldAllowNullActionEvent() throws Exception { NavigationOutcome outcome = new NavigationOutcome(new Object()); DestinationAndModel dam = new DestinationAndModel(outcome, (ActionEvent) null); assertThat(dam.getComponent(), is(nullValue())); }
@Test public void shouldObtainComponentFromActionEvent() throws Exception { NavigationOutcome outcome = new NavigationOutcome(new Object()); UIComponent component = mock(UIComponent.class); ActionEvent actionEvent = new ActionEvent(component); DestinationAndModel dam = new DestinationAndModel(outcome, actionEvent); assertThat(dam.getComponent(), is(sameInstance(component))); }