Пример #1
0
 public void assertEventsReceived(TestState... expectedTypes) {
   ArrayList<TestState> actualTypes = new ArrayList<TestState>();
   for (TestEvent event : testEvents) {
     actualTypes.add(event.getType());
   }
   assertEquals(asList(expectedTypes), actualTypes);
 }
Пример #2
0
 public Iterable<String> getTestsRun() {
   Set<String> tests = newHashSet();
   for (TestEvent event : testEvents) {
     tests.add(event.getTestName());
   }
   return tests;
 }
 @Override
 public int hashCode() {
   return Objects.hashCode(event)
       ^ Objects.hashCode(event.getMessage())
       ^ Objects.hashCode(event.getPointOfFailure())
       ^ Arrays.hashCode(event.getStackTrace());
 }
Пример #4
0
 @Override
 public String toString() {
   StringBuilder builder = new StringBuilder();
   for (TestEvent each : testEvents) {
     builder.append(each.toString() + each.getErrorClassName() + each.getMessage());
   }
   return builder.toString();
 }
Пример #5
0
 public void assertTestsStarted(String... testNames) {
   // Also asserts the order
   List<String> startedTests = new ArrayList<String>();
   for (TestEvent event : testEvents) {
     if (event.getType().equals(TEST_CASE_STARTING)) {
       startedTests.add(event.getTestName());
     }
   }
   assertEquals(asList(testNames), startedTests);
 }
 @Override
 public boolean equals(Object obj) {
   if (obj instanceof TestEventEqualityAdapter) {
     TestEventEqualityAdapter other = (TestEventEqualityAdapter) obj;
     return Objects.equal(event, other.event)
         && Objects.equal(event.getMessage(), other.event.getMessage())
         && Objects.equal(event.getPointOfFailure(), other.event.getPointOfFailure())
         && Arrays.equals(event.getStackTrace(), other.event.getStackTrace());
   }
   return false;
 }
Пример #7
-1
  public EventInfoFrame(TestEvent event) {
    setAlwaysOnTop(true);
    textArea = new JTextArea(stackTraceToString(event.getStackTrace()));
    textArea.setEditable(false);
    textArea.setColumns(80);
    textArea.setWrapStyleWord(true);
    textArea.setLineWrap(true);
    getContentPane().add(new JScrollPane(textArea));
    Container southPanel = new JPanel(new FlowLayout());
    Action disposeAction =
        new AbstractAction("Close") {
          private static final long serialVersionUID = -1L;

          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        };
    closeButton = new JButton(disposeAction);
    southPanel.add(closeButton);
    getContentPane().add(southPanel, BorderLayout.SOUTH);
    String message = event.getMessage();
    if (message == null) {
      message = "";
    }
    setTitle(event.getTestName() + "." + event.getTestMethod() + "()");
    pack();
    closeButton.requestFocusInWindow();
  }