mil.dod.th.ose.gui.webapp/test/mil/dod/th/ose/gui/webapp/utils/TestLayoutCollapsed.java
@Test
    public void testLayoutsCollapsed()
    {
        LayoutCollapsed layoutCollapsed = new LayoutCollapsed();
        
        //make sure the collapsed attribute for controllers and navigation is set from instantiating the layoutCollapsed
        //class and make sure they default to false indicating that they default to expanded
        assertThat(layoutCollapsed.isControllerCollapsed(), is(notNullValue()));
        assertThat(layoutCollapsed.isNavigationCollapsed(), is(notNullValue()));
        assertThat(layoutCollapsed.isControllerCollapsed(), is(false));
        assertThat(layoutCollapsed.isNavigationCollapsed(), is(false));
        
        LayoutUnit controllerLayout = new LayoutUnit();
        LayoutUnit navigationLayout = new LayoutUnit();
        
        //ids of the controller and navigation layout are required to be these respectively.. since we get the layout
        //unit object based off their id
        controllerLayout.setId("controllerLayout");
        navigationLayout.setId("navigationLayout");
        
        //mock toggle events and associate the events with the respective layouts
        ToggleEvent toggleEast = mock(ToggleEvent.class);
        when(toggleEast.getComponent()).thenReturn(controllerLayout);
       
        ToggleEvent toggleWest = mock(ToggleEvent.class);
        when(toggleWest.getComponent()).thenReturn(navigationLayout);
        
        //create toggle events for the layouts and associate the mocked toggle events with them
        layoutCollapsed.handleToggle(toggleEast);
        layoutCollapsed.handleToggle(toggleWest);
        
        //make sure that after the toggle events were raised the layout unit's collapsed attributes have now changed
        assertThat(layoutCollapsed.isControllerCollapsed(), is(true));
        assertThat(layoutCollapsed.isNavigationCollapsed(), is(true));
        
        layoutCollapsed.handleToggle(toggleEast);
        layoutCollapsed.handleToggle(toggleWest);
        
        assertThat(layoutCollapsed.isControllerCollapsed(), is(false));
        assertThat(layoutCollapsed.isNavigationCollapsed(), is(false));
    }
/**
     * Verify toggling of layout components is accurately tracked.
     */
Verify toggling of layout components is accurately tracked.
Verify toggling of layout components is accurately tracked .
@Test
    public void testLayoutsCollapsed()
    {
        LayoutCollapsed layoutCollapsed = new LayoutCollapsed();
        assertThat(layoutCollapsed.isControllerCollapsed(), is(notNullValue()));
        assertThat(layoutCollapsed.isNavigationCollapsed(), is(notNullValue()));
        assertThat(layoutCollapsed.isControllerCollapsed(), is(false));
        assertThat(layoutCollapsed.isNavigationCollapsed(), is(false));
        LayoutUnit controllerLayout = new LayoutUnit();
        LayoutUnit navigationLayout = new LayoutUnit();
        controllerLayout.setId("controllerLayout");
        navigationLayout.setId("navigationLayout");
        ToggleEvent toggleEast = mock(ToggleEvent.class);
        when(toggleEast.getComponent()).thenReturn(controllerLayout);
        ToggleEvent toggleWest = mock(ToggleEvent.class);
        when(toggleWest.getComponent()).thenReturn(navigationLayout);
        layoutCollapsed.handleToggle(toggleEast);
        layoutCollapsed.handleToggle(toggleWest);
        assertThat(layoutCollapsed.isControllerCollapsed(), is(true));
        assertThat(layoutCollapsed.isNavigationCollapsed(), is(true));
        layoutCollapsed.handleToggle(toggleEast);
        layoutCollapsed.handleToggle(toggleWest);
        assertThat(layoutCollapsed.isControllerCollapsed(), is(false));
        assertThat(layoutCollapsed.isNavigationCollapsed(), is(false));
    }
@ Test public void testLayoutsCollapsed ( ) { LayoutCollapsed layoutCollapsed = new LayoutCollapsed ( ) ; assertThat ( layoutCollapsed . isControllerCollapsed ( ) , is ( notNullValue ( ) ) ) ; assertThat ( layoutCollapsed . isNavigationCollapsed ( ) , is ( notNullValue ( ) ) ) ; assertThat ( layoutCollapsed . isControllerCollapsed ( ) , is ( false ) ) ; assertThat ( layoutCollapsed . isNavigationCollapsed ( ) , is ( false ) ) ; LayoutUnit controllerLayout = new LayoutUnit ( ) ; LayoutUnit navigationLayout = new LayoutUnit ( ) ; controllerLayout . setId ( "controllerLayout" ) ; navigationLayout . setId ( "navigationLayout" ) ; ToggleEvent toggleEast = mock ( ToggleEvent . class ) ; when ( toggleEast . getComponent ( ) ) . thenReturn ( controllerLayout ) ; ToggleEvent toggleWest = mock ( ToggleEvent . class ) ; when ( toggleWest . getComponent ( ) ) . thenReturn ( navigationLayout ) ; layoutCollapsed . handleToggle ( toggleEast ) ; layoutCollapsed . handleToggle ( toggleWest ) ; assertThat ( layoutCollapsed . isControllerCollapsed ( ) , is ( true ) ) ; assertThat ( layoutCollapsed . isNavigationCollapsed ( ) , is ( true ) ) ; layoutCollapsed . handleToggle ( toggleEast ) ; layoutCollapsed . handleToggle ( toggleWest ) ; assertThat ( layoutCollapsed . isControllerCollapsed ( ) , is ( false ) ) ; assertThat ( layoutCollapsed . isNavigationCollapsed ( ) , is ( false ) ) ; }
Verify toggling of layout components is accurately tracked.
Verify toggling of layout components is accurately tracked .
//make sure the collapsed attribute for controllers and navigation is set from instantiating the layoutCollapsed //class and make sure they default to false indicating that they default to expanded //ids of the controller and navigation layout are required to be these respectively.. since we get the layout //unit object based off their id //mock toggle events and associate the events with the respective layouts //create toggle events for the layouts and associate the mocked toggle events with them //make sure that after the toggle events were raised the layout unit's collapsed attributes have now changed