예제 #1
0
 @Test
 public void testSetAction() {
   Action localAction = EasyMock.createMock(Action.class);
   EasyMock.replay(localAction);
   injecter.setAction(localAction);
   EasyMock.verify(localAction);
 }
예제 #2
0
 @Test
 public void testSetClassResource() {
   ClassResource cr = EasyMock.createMock(ClassResource.class);
   EasyMock.replay(cr);
   injecter.setClassResource(cr);
   EasyMock.verify(cr);
 }
예제 #3
0
  @Test
  public void testInject_mnemonic() {
    initializeInjecter();
    injecter.inject();

    Object mnemonicValue = action.getValue(Action.MNEMONIC_KEY);
    assertEquals(new Integer(KeyEvent.VK_A), mnemonicValue);
  }
예제 #4
0
  @Test
  public void testInject_accelerator() {
    initializeInjecter();
    injecter.inject();

    Object keystrokeValue = action.getValue(Action.ACCELERATOR_KEY);
    assertEquals(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK), keystrokeValue);
  }
예제 #5
0
  @Test
  public void testInject_longDescription() {
    initializeInjecter();
    injecter.inject();

    Object longDescValue = action.getValue(Action.LONG_DESCRIPTION);
    assertEquals("A very long description of action1", longDescValue);
  }
예제 #6
0
  @Test
  public void testInject_shortDescription() {
    initializeInjecter();
    injecter.inject();

    Object shortDescValue = action.getValue(Action.SHORT_DESCRIPTION);
    assertEquals("Short description of action1", shortDescValue);
  }
예제 #7
0
  @Test
  public void testInject_Name() {
    initializeInjecter();
    injecter.inject();

    Object nameValue = action.getValue(Action.NAME);
    assertEquals("Name1", nameValue);
  }
예제 #8
0
  @Test
  public void testInject_largeIcon() {
    initializeInjecter();
    injecter.inject();

    Object largeIconValue = action.getValue(Action.LARGE_ICON_KEY);
    assertNotNull(largeIconValue);
    assertTrue(Icon.class.isAssignableFrom(largeIconValue.getClass()));
  }
예제 #9
0
  @Test
  public void testInject_smallIcon() {
    initializeInjecter();
    injecter.inject();

    Object smallIconValue = action.getValue(Action.SMALL_ICON);
    assertNotNull(smallIconValue);
    assertTrue(Icon.class.isAssignableFrom(smallIconValue.getClass()));
  }
예제 #10
0
 @Test
 public void testSetActionKey() {
   injecter.setActionKey("action.key");
 }
예제 #11
0
 @Test(expected = NullPointerException.class)
 public void testSetAction_nullArg() {
   injecter.setAction(null);
 }
예제 #12
0
 @Test(expected = NullPointerException.class)
 public void testSetClassResource_nullArg() {
   injecter.setClassResource(null);
 }
예제 #13
0
 private void initializeInjecter() {
   injecter.setClassResource(sampleRes);
   injecter.setAction(action);
   injecter.setActionKey("doAction1");
 }
예제 #14
0
 @Test(expected = IllegalArgumentException.class)
 public void testSetActionKey_emptyArg() {
   injecter.setActionKey("");
 }