From 350bf19442a15a56369348ab8e2e7a6dd8c3e105 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Thu, 12 Mar 2015 11:51:10 +0100 Subject: [PATCH] Fixed issues with decimal number --- .../TestExecutionResultSavingTestListener.groovy | 6 +++++- src/test/groovy/integration/TimeoutFuncSpec.groovy | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/groovy/com/blogspot/toomuchcoding/testprofiler/TestExecutionResultSavingTestListener.groovy b/src/main/groovy/com/blogspot/toomuchcoding/testprofiler/TestExecutionResultSavingTestListener.groovy index bf2004c..04f8cb4 100644 --- a/src/main/groovy/com/blogspot/toomuchcoding/testprofiler/TestExecutionResultSavingTestListener.groovy +++ b/src/main/groovy/com/blogspot/toomuchcoding/testprofiler/TestExecutionResultSavingTestListener.groovy @@ -68,7 +68,11 @@ class TestExecutionResultSavingTestListener implements TestListener { } private boolean testExecutionTimeIsBelowMaxThreshold(long executionTimeInMs) { - return executionTimeInMs >= testProfilerPluginExtension.buildBreakerOptions.maxTestThreshold + return getMaxTestThreshold() != null && executionTimeInMs >= getMaxTestThreshold() + } + + private Integer getMaxTestThreshold() { + return testProfilerPluginExtension.buildBreakerOptions.maxTestThreshold } private void performAdditionalLogic(TestDescriptor testDescriptor, TestExecutionResult testExecutionResult, long executionTimeInMs) { diff --git a/src/test/groovy/integration/TimeoutFuncSpec.groovy b/src/test/groovy/integration/TimeoutFuncSpec.groovy index 8f03af9..724474a 100644 --- a/src/test/groovy/integration/TimeoutFuncSpec.groovy +++ b/src/test/groovy/integration/TimeoutFuncSpec.groovy @@ -4,6 +4,8 @@ import nebula.test.IntegrationSpec import nebula.test.functional.ExecutionResult import spock.lang.Unroll +import java.text.DecimalFormatSymbols + class TimeoutFuncSpec extends IntegrationSpec { void setup() { @@ -20,8 +22,8 @@ class TimeoutFuncSpec extends IntegrationSpec { String stdout = result.standardOutput.toString() assertThatTestFailed(stdout, 'foo.CalculatorTest') assertThatTestFailed(stdout, 'foo.CalculatorSpec') - assertThatStandardOuputContains(stdout, 'test timed out after 1 milliseconds') - assertThatStandardOuputContains(stdout, 'Method timed out after 0.00 seconds') + assertThatStandardOutputContains(stdout, 'test timed out after 1 milliseconds') + assertThatStandardOutputContains(stdout, "Method timed out after 0${DecimalFormatSymbols.getInstance().decimalSeparator}00 seconds") where: projectName << ['project_with_timeout', 'project_with_timeout_with_spock_1'] } @@ -30,7 +32,7 @@ class TimeoutFuncSpec extends IntegrationSpec { assert standardOutput.contains("$className > should_add_two_numbers FAILED") } - void assertThatStandardOuputContains(String standardOutput, String text) { + void assertThatStandardOutputContains(String standardOutput, String text) { assert standardOutput.contains(text) }