### Question:
ApplicationLayout extends VerticalLayout implements ViewDisplay { @Override public void showView(View view) { if (view instanceof Component) { setMainArea((Component)view); } else { throw new IllegalArgumentException( "View is not a component: " + view); } } ApplicationLayout(ApplicationHeader header, @CheckForNull ApplicationFooter footer); @Override void showView(View view);  }### Answer:
@Test public void testShowView() { setUpApplicationLayout(); assertThat(applicationLayout.getComponentCount(), is(3)); assertThat(applicationLayout.getComponent(1), is(instanceOf(EmptyView.class))); View view = mock(View.class, withSettings().extraInterfaces(Component.class)); applicationLayout.showView(view); assertThat(applicationLayout.getComponentCount(), is(3)); assertThat(applicationLayout.getComponent(1), is(view)); View view2 = mock(View.class, withSettings().extraInterfaces(Component.class)); applicationLayout.showView(view2); assertThat(applicationLayout.getComponentCount(), is(3)); assertThat(applicationLayout.getComponent(1), is(view2)); }
@Test public void testShowView_NoFooter() { applicationLayout = new ApplicationLayout(header, null); assertThat(applicationLayout.getComponentCount(), is(2)); assertThat(applicationLayout.getComponent(1), is(instanceOf(EmptyView.class))); View view = mock(View.class, withSettings().extraInterfaces(Component.class)); applicationLayout.showView(view); assertThat(applicationLayout.getComponentCount(), is(2)); assertThat(applicationLayout.getComponent(1), is(view)); View view2 = mock(View.class, withSettings().extraInterfaces(Component.class)); applicationLayout.showView(view2); assertThat(applicationLayout.getComponentCount(), is(2)); assertThat(applicationLayout.getComponent(1), is(view2)); }