Ejemplo n.º 1
0
  private void createGUI(DialogOwner owner) {

    switch (owner) {
      case HIDDEN_DIALOG:
        parentDialog = new Dialog((Frame) null);
        dialog = new TestDialog(parentDialog);
        break;
      case NULL_DIALOG:
        dialog = new TestDialog((Dialog) null);
        break;
      case HIDDEN_FRAME:
        parentFrame = new Frame();
        dialog = new TestDialog(parentFrame);
        break;
      case NULL_FRAME:
        dialog = new TestDialog((Frame) null);
        break;
    }

    assertFalse(dialog == null, "error: null dialog");

    dialog.setLocation(50, 50);
    if (setModal) {
      dialog.setModal(true);
    } else if (modalityType != null) {
      dialog.setModalityType(modalityType);
    }

    dialog.setVisible(true);
  }
Ejemplo n.º 2
0
 @SuppressWarnings("unchecked")
 public static <T extends Comparable<T>> void run(Assertion assertion, T... args) {
   String msg = "Expected " + format(assertion, (Object[]) args) + " to pass";
   switch (assertion) {
     case LT:
       assertLessThan(args[0], args[1], msg);
       break;
     case LTE:
       assertLessThanOrEqual(args[0], args[1], msg);
       break;
     case EQ:
       assertEquals(args[0], args[1], msg);
       break;
     case GTE:
       assertGreaterThanOrEqual(args[0], args[1], msg);
       break;
     case GT:
       assertGreaterThan(args[0], args[1], msg);
       break;
     case NE:
       assertNotEquals(args[0], args[1], msg);
       break;
     case NULL:
       assertNull(args == null ? args : args[0], msg);
       break;
     case NOTNULL:
       assertNotNull(args == null ? args : args[0], msg);
       break;
     case FALSE:
       assertFalse((Boolean) args[0], msg);
       break;
     case TRUE:
       assertTrue((Boolean) args[0], msg);
       break;
     default:
       // do nothing
   }
 }