Java Code Examples for org.junit.Ignore#value()

The following examples show how to use org.junit.Ignore#value() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SMTestSender.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void prepareIgnoreMessage(Description description, boolean commentMessage) {
  Map attrs = new HashMap();
  if (commentMessage) {
    try {
      final Ignore ignoredAnnotation = (Ignore)description.getAnnotation(Ignore.class);
      if (ignoredAnnotation != null) {
        final String val = ignoredAnnotation.value();
        if (val != null) {
          attrs.put("message", val);
        }
      }
    }
    catch (NoSuchMethodError ignored) {
      //junit < 4.4
    }
  }
  attrs.put("name", getMethodName(description));
  System.out.println(ServiceMessage.asString(ServiceMessageTypes.TEST_IGNORED, attrs));
}
 
Example 2
Source File: AtsJunitTestListener.java    From ats-framework with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @see org.junit.runner.notification.RunListener#testIgnored(org.junit.runner.Description)
 */
@Override
public void testIgnored( Description description ) throws Exception {
    
    if (!ActiveDbAppender.isAttached) {
        return;
    }

    if (log.isDebugEnabled()) {
        log.info("testIgnored(): description: " + description.getDisplayName() + "| is test: "
                 + description.isTest() + "| test class: " + description.getClassName()
                 + "| test method: " + description.getMethodName() + "| children: 0? =>"
                 + description.getChildren());
    }
    // manually invoking testStarted()
    testStarted(description);

    String ignoreDetails = "";
    Ignore ignoreAnnotation = getMethod(description).getAnnotation(Ignore.class);
    if (ignoreAnnotation != null) {
        ignoreDetails = ignoreAnnotation.value();
    }
    if (ignoreDetails.isEmpty()) {
        logger.info(MSG__TEST_IGNORED);
    } else {
        logger.info(MSG__TEST_IGNORED + " Details: " + ignoreDetails);
    }

    //open a performance test scenario and test case
    logger.endTestcase(TestCaseResult.SKIPPED);
    sendTestEndEventToAgents();

    super.testIgnored(description);
}
 
Example 3
Source File: AllureRunListener.java    From allure-cucumberjvm with Apache License 2.0 5 votes vote down vote up
public String
getIgnoredMessage(Description description) {
    Ignore ignore = description.getAnnotation(Ignore.class
    );
    return ignore
            == null || ignore.value()
            .isEmpty() ? "Test ignored (without reason)!" : ignore.value();
}
 
Example 4
Source File: AllureMarathonRunListener.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public String getIgnoredMessage(Description description) {
    Ignore ignore = description.getAnnotation(Ignore.class);
    return ignore == null || ignore.value().isEmpty() ? "Test ignored (without reason)!" : ignore.value();
}
 
Example 5
Source File: AllureJunit4.java    From allure-java with Apache License 2.0 4 votes vote down vote up
private StatusDetails getIgnoredMessage(final Description description) {
    final Ignore ignore = description.getAnnotation(Ignore.class);
    final String message = Objects.nonNull(ignore) && !ignore.value().isEmpty()
            ? ignore.value() : "Test ignored (without reason)!";
    return new StatusDetails().setMessage(message);
}
 
Example 6
Source File: AllureRunListener.java    From allure1 with Apache License 2.0 4 votes vote down vote up
public String getIgnoredMessage(Description description) {
    Ignore ignore = description.getAnnotation(Ignore.class);
    return ignore == null || ignore.value().isEmpty() ? "Test ignored (without reason)!" : ignore.value();
}