Package gov.nasa.arc.mct.gui

Examples of gov.nasa.arc.mct.gui.ContextAwareAction.canHandle()


        // Should always be enabled if canHandle
        ContextAwareAction refresh = new RefreshAction();
       
        // Verify precondition (also verifed in previous test)
        // canHandle is a necessary part of ContextAwareAction life cycle
        Assert.assertTrue(refresh.canHandle(mockContext));
       
        // Verify that refresh menu item is enabled
        Assert.assertTrue(refresh.isEnabled());
    }
   
View Full Code Here


        View newerView = Mockito.mock(View.class);
        Mockito.when(mockViewInfo.createView(newerComponent)).thenReturn(newerView);
       
        // Create refresh action, obey life cycle
        ContextAwareAction refresh = new RefreshAction();
        Assert.assertTrue(refresh.canHandle(mockContext));
       
        // Verify preconditions
        Mockito.verifyZeroInteractions(mockWindowManager);
        Mockito.verifyZeroInteractions(mockContentArea);
        Mockito.verifyZeroInteractions(mockViewInfo);
View Full Code Here

            }
        });
       
        // Create refresh action, obey life cycle
        ContextAwareAction refresh = new RefreshAction();
        Assert.assertTrue(refresh.canHandle(mockContext));
       
        // Verify preconditions
        Mockito.verifyZeroInteractions(mockWindowManager);
        Mockito.verifyZeroInteractions(mockContentArea);
        Mockito.verifyZeroInteractions(mockViewInfo);       
View Full Code Here

        // Verify interactions with a mock inspector
        Mockito.when(mockContext.getWindowManifestation()).thenReturn(mockInspector);
       
        // Verify that refresh can handle, is enabled for an Inspector
        ContextAwareAction refresh = new RefreshAction();
        Assert.assertTrue(refresh.canHandle(mockContext));
        Assert.assertTrue(refresh.isEnabled());
       
        // Verify actionPerformed triggers appropriate method
        refresh.actionPerformed(mockEvent);
        Mockito.verify(mockInspector).setHousedViewManifestation(mockViewInfo);
View Full Code Here

        // Verifies that QuitAction is available in appropriate cases
        initializeRegistry(housings);
        ContextAwareAction quit = new QuitAction();
   
        // Should only handle or be enabled when there are windows open
        Assert.assertEquals(quit.canHandle(mockActionContext), housings > 0);
        Assert.assertEquals(quit.isEnabled(), housings > 0);
    }
   
    @Test (dataProvider = "generateTestCases")
    public void testActionPerformed(final boolean confirmed, int housings) throws Exception {
View Full Code Here

                return confirmed ? options[0] : options[1]; // options[0] presumed to mean "OK"
            }
        });
       
        // Already tested in testQuitEnabled, but also need to obey action's life cycle
        Assert.assertEquals(quit.canHandle(mockActionContext), housings > 0);
       
        // Trigger the action - this is the method we are testing
        quit.actionPerformed(mockEvent);
       
        // A dialog should have been requested
View Full Code Here

                return confirmed ? options[0] : options[1]; // options[0] presumed to mean "OK"
            }
        });
       
        // Already tested in testQuitEnabled, but also need to obey action's life cycle
        Assert.assertEquals(quit.canHandle(mockActionContext), housings > 0);
       
        // Trigger the action - this is the method we are testing
        quit.actionPerformed(mockEvent);
       
        // A dialog should have been requested
View Full Code Here

            return null;

        for (Class<? extends ContextAwareAction> actionClass : actionClassList) {
            try {
                ContextAwareAction action = actionClass.newInstance();
                if (action.canHandle(context))
                    return action;
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.