public class PrintIgnoreRunListener extends RunListener { @Override public void testIgnored(Description description) throws Exception { super.testIgnored(description); Ignore ignore = description.getAnnotation(Ignore.class); String ignoreMessage = String.format( "@Ignore test method '%s()': '%s'", description.getMethodName(), ignore.value()); System.out.println(ignoreMessage); } }
private boolean equalValue( Ignore ignore ) { return ignore != null && ignore.value().equals( value ); } }
private boolean equalValue( Ignore ignore ) { if ( ignore == null ) { return false; } else { String val = ignore.value(); return val == null ? value == null : val.equals( value ); } } }
public static String getAnnotatedIgnoreValue( Description description ) { final Ignore ignore = getAnnotatedIgnore( description ); return ignore != null ? ignore.value() : null; }
public static String getIgnoredMessage(Description description) { String message = null; Ignore ignore = description.getAnnotation(Ignore.class); if (ignore != null) { message = ignore.value(); } return message; }
static String getAnnotatedIgnoreValue( Description description ) { final Ignore ignore = getAnnotatedIgnore( description ); return ignore != null ? ignore.value() : null; }
public static String getIgnoredMessage(Description description) { String message = null; Ignore ignore = description.getAnnotation(Ignore.class); if (ignore != null) { message = ignore.value(); } return message; }
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); }
/** * Here we handle annotations like {@code @Ignore} where the execution of * the test method should be ignored. * * @param method * the test method * @return true or false */ protected final boolean shouldBeIgnored(final FrameworkMethod method) { Ignore ignore = method.getAnnotation(Ignore.class); if (ignore != null) { if (LOG.isDebugEnabled()) { String reason = ignore.value(); if (StringUtils.isNotEmpty(reason)) { reason = " (" + reason + ")"; } LOG.debug(this.getTestClass().getName() + "." + method.getName() + " ignored" + reason); } return true; } return this.xfilter.shouldBeIgnored(describeChild(method)); }