Skip to content

Commit

Permalink
Fixed issues with decimal number
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Grzejszczak committed Mar 12, 2015
1 parent dc0db98 commit 350bf19
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 5 additions & 3 deletions src/test/groovy/integration/TimeoutFuncSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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']
}
Expand All @@ -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)
}

Expand Down

0 comments on commit 350bf19

Please sign in to comment.