Java Code Examples for org.gradle.api.tasks.testing.TestDescriptor#getClassName()
The following examples show how to use
org.gradle.api.tasks.testing.TestDescriptor#getClassName() .
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: ShortExceptionFormatter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private void printException(TestDescriptor descriptor, Throwable exception, boolean cause, int indentLevel, StringBuilder builder) { String indent = Strings.repeat(INDENT, indentLevel); builder.append(indent); if (cause) { builder.append("Caused by: "); } String className = exception instanceof PlaceholderException ? ((PlaceholderException) exception).getExceptionClassName() : exception.getClass().getName(); builder.append(className); StackTraceFilter filter = new StackTraceFilter(new ClassMethodNameStackTraceSpec(descriptor.getClassName(), null)); List<StackTraceElement> stackTrace = filter.filter(exception); if (stackTrace.size() > 0) { StackTraceElement element = stackTrace.get(0); builder.append(" at "); builder.append(element.getFileName()); builder.append(':'); builder.append(element.getLineNumber()); } builder.append('\n'); if (testLogging.getShowCauses() && exception.getCause() != null) { printException(descriptor, exception.getCause(), true, indentLevel + 1, builder); } }
Example 2
Source File: ShortExceptionFormatter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private void printException(TestDescriptor descriptor, Throwable exception, boolean cause, int indentLevel, StringBuilder builder) { String indent = Strings.repeat(INDENT, indentLevel); builder.append(indent); if (cause) { builder.append("Caused by: "); } String className = exception instanceof PlaceholderException ? ((PlaceholderException) exception).getExceptionClassName() : exception.getClass().getName(); builder.append(className); StackTraceFilter filter = new StackTraceFilter(new ClassMethodNameStackTraceSpec(descriptor.getClassName(), null)); List<StackTraceElement> stackTrace = filter.filter(exception); if (stackTrace.size() > 0) { StackTraceElement element = stackTrace.get(0); builder.append(" at "); builder.append(element.getFileName()); builder.append(':'); builder.append(element.getLineNumber()); } builder.append('\n'); if (testLogging.getShowCauses() && exception.getCause() != null) { printException(descriptor, exception.getCause(), true, indentLevel + 1, builder); } }
Example 3
Source File: ShortExceptionFormatter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private void printException(TestDescriptor descriptor, Throwable exception, boolean cause, int indentLevel, StringBuilder builder) { String indent = Strings.repeat(INDENT, indentLevel); builder.append(indent); if (cause) { builder.append("Caused by: "); } String className = exception instanceof PlaceholderException ? ((PlaceholderException) exception).getExceptionClassName() : exception.getClass().getName(); builder.append(className); StackTraceFilter filter = new StackTraceFilter(new ClassMethodNameStackTraceSpec(descriptor.getClassName(), null)); List<StackTraceElement> stackTrace = filter.filter(exception); if (stackTrace.size() > 0) { StackTraceElement element = stackTrace.get(0); builder.append(" at "); builder.append(element.getFileName()); builder.append(':'); builder.append(element.getLineNumber()); } builder.append('\n'); if (testLogging.getShowCauses() && exception.getCause() != null) { printException(descriptor, exception.getCause(), true, indentLevel + 1, builder); } }
Example 4
Source File: ShortExceptionFormatter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private void printException(TestDescriptor descriptor, Throwable exception, boolean cause, int indentLevel, StringBuilder builder) { String indent = Strings.repeat(INDENT, indentLevel); builder.append(indent); if (cause) { builder.append("Caused by: "); } String className = exception instanceof PlaceholderException ? ((PlaceholderException) exception).getExceptionClassName() : exception.getClass().getName(); builder.append(className); StackTraceFilter filter = new StackTraceFilter(new ClassMethodNameStackTraceSpec(descriptor.getClassName(), null)); List<StackTraceElement> stackTrace = filter.filter(exception); if (stackTrace.size() > 0) { StackTraceElement element = stackTrace.get(0); builder.append(" at "); builder.append(element.getFileName()); builder.append(':'); builder.append(element.getLineNumber()); } builder.append('\n'); if (testLogging.getShowCauses() && exception.getCause() != null) { printException(descriptor, exception.getCause(), true, indentLevel + 1, builder); } }
Example 5
Source File: FullExceptionFormatter.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private Spec<StackTraceElement> createFilter(TestDescriptor descriptor, TestStackTraceFilter filterType) { switch (filterType) { case ENTRY_POINT: return new ClassMethodNameStackTraceSpec(descriptor.getClassName(), descriptor.getName()); case TRUNCATE: return new TruncatedStackTraceSpec(new ClassMethodNameStackTraceSpec(descriptor.getClassName(), null)); case GROOVY: return new GroovyStackTraceSpec(); default: throw new AssertionError(); } }
Example 6
Source File: FullExceptionFormatter.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private Spec<StackTraceElement> createFilter(TestDescriptor descriptor, TestStackTraceFilter filterType) { switch (filterType) { case ENTRY_POINT: return new ClassMethodNameStackTraceSpec(descriptor.getClassName(), descriptor.getName()); case TRUNCATE: return new TruncatedStackTraceSpec(new ClassMethodNameStackTraceSpec(descriptor.getClassName(), null)); case GROOVY: return new GroovyStackTraceSpec(); default: throw new AssertionError(); } }
Example 7
Source File: FullExceptionFormatter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private Spec<StackTraceElement> createFilter(TestDescriptor descriptor, TestStackTraceFilter filterType) { switch (filterType) { case ENTRY_POINT: return new ClassMethodNameStackTraceSpec(descriptor.getClassName(), descriptor.getName()); case TRUNCATE: return new TruncatedStackTraceSpec(new ClassMethodNameStackTraceSpec(descriptor.getClassName(), null)); case GROOVY: return new GroovyStackTraceSpec(); default: throw new AssertionError(); } }
Example 8
Source File: FullExceptionFormatter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private Spec<StackTraceElement> createFilter(TestDescriptor descriptor, TestStackTraceFilter filterType) { switch (filterType) { case ENTRY_POINT: return new ClassMethodNameStackTraceSpec(descriptor.getClassName(), descriptor.getName()); case TRUNCATE: return new TruncatedStackTraceSpec(new ClassMethodNameStackTraceSpec(descriptor.getClassName(), null)); case GROOVY: return new GroovyStackTraceSpec(); default: throw new AssertionError(); } }
Example 9
Source File: GradleTestSuiteCollector.java From gradle-metrics-plugin with Apache License 2.0 | 5 votes |
@Override public void afterTest(TestDescriptor testDescriptor, TestResult testResult) { checkNotNull(testDescriptor); checkNotNull(testResult); Result result = getTestResult(testResult); org.gradle.api.tasks.testing.Test testTask = (org.gradle.api.tasks.testing.Test) task; String suiteName = testTask.getName(); long startTime = testResult.getStartTime(); long elapsed = testResult.getEndTime() - startTime; Test test = new Test(testDescriptor.getName(), testDescriptor.getClassName(), suiteName, result, new DateTime(startTime), elapsed); dispatcherSupplier.get().test(test); }
Example 10
Source File: AbstractTestLogger.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
private boolean isAtomicTestWhoseParentIsNotTheTestClass(TestDescriptor current) { return !current.isComposite() && current.getClassName() != null && (current.getParent() == null || !current.getClassName().equals(current.getParent().getName())); }
Example 11
Source File: AbstractTestLogger.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
private boolean isAtomicTestWhoseParentIsNotTheTestClass(TestDescriptor current) { return !current.isComposite() && current.getClassName() != null && (current.getParent() == null || !current.getClassName().equals(current.getParent().getName())); }
Example 12
Source File: AbstractTestLogger.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
private boolean isAtomicTestWhoseParentIsNotTheTestClass(TestDescriptor current) { return !current.isComposite() && current.getClassName() != null && (current.getParent() == null || !current.getClassName().equals(current.getParent().getName())); }
Example 13
Source File: AbstractTestLogger.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
private boolean isAtomicTestWhoseParentIsNotTheTestClass(TestDescriptor current) { return !current.isComposite() && current.getClassName() != null && (current.getParent() == null || !current.getClassName().equals(current.getParent().getName())); }