コード例 #1
0
 @Test
 public void testPrettyPrintNullSafe2() {
   ModelFactory mf = ModelFactory.eINSTANCE;
   ErrorReport report = mf.createErrorReport();
   report.setStatus(mf.createStatus());
   Reports.prettyPrint(report);
 }
コード例 #2
0
  @Test
  public void testClearEventMessage() {
    ErrorReport event = createTestReport();

    Reports.clearMessages(event);

    assertThat(event.getStatus().getMessage(), is(ANONYMIZED_TAG));
  }
コード例 #3
0
  @Test
  public void testPrettyPrintSkipsNullException() {
    ModelFactory mf = ModelFactory.eINSTANCE;

    ErrorReport report = mf.createErrorReport();
    report.setStatus(mf.createStatus());
    String prettyPrint = Reports.prettyPrint(report);
    assertThat(prettyPrint, not(containsString("Exception")));
  }
コード例 #4
0
  @Test
  public void testPrettyPrintNullSafe3() {
    ModelFactory mf = ModelFactory.eINSTANCE;

    ErrorReport report = mf.createErrorReport();
    report.setStatus(mf.createStatus());
    Throwable t = mf.createThrowable();
    t.setClassName("org.test");
    report.getStatus().setException(t);
    Reports.prettyPrint(report);
  }
コード例 #5
0
  @Test
  public void testCreateAnonymizedSendCopyInsertNameAndEmail() {
    ModelFactory mf = ModelFactory.eINSTANCE;

    ErrorReport report = mf.createErrorReport();
    settings.setName("foobarbaz");
    settings.setEmail("*****@*****.**");

    ErrorReport copy = Reports.createAnonymizedSendCopy(report, settings, configuration);
    assertThat(copy.getName(), is("foobarbaz"));
    assertThat(copy.getEmail(), is("*****@*****.**"));
  }
コード例 #6
0
  @Test
  public void testCreateAnonymizedSendCopyAnonymizes() {
    ModelFactory mf = ModelFactory.eINSTANCE;

    ErrorReport report = mf.createErrorReport();
    report.setStatus(mf.createStatus());
    java.lang.Throwable throwable = new RuntimeException("test exception");
    throwable.fillInStackTrace();
    Throwable t = Reports.newThrowable(throwable);
    report.getStatus().setException(t);

    settings.setAnonymizeMessages(true);
    settings.setAnonymizeStrackTraceElements(true);
    configuration.setAcceptedPackages(new ArrayList<String>());
    ErrorReport copy = Reports.createAnonymizedSendCopy(report, settings, configuration);
    assertThat(copy.getStatus().getMessage(), is(Constants.HIDDEN));
    StackTraceElement stackTraceElement = copy.getStatus().getException().getStackTrace().get(0);
    assertThat(stackTraceElement.getClassName(), is(Constants.HIDDEN));
    assertThat(stackTraceElement.getMethodName(), is(Constants.HIDDEN));
    assertThat(stackTraceElement.getFileName(), is(Constants.HIDDEN));
    assertThat(stackTraceElement.getLineNumber(), is(-1));
  }