You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2019/08/22 11:30:30 UTC
[jmeter] branch master updated: More unit tests for automatic
conversion
This is an automated email from the ASF dual-hosted git repository.
fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git
The following commit(s) were added to refs/heads/master by this push:
new 5509da1 More unit tests for automatic conversion
5509da1 is described below
commit 5509da12ec0f742416fa5fa2c67e3f2c36126642
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Thu Aug 22 13:30:14 2019 +0200
More unit tests for automatic conversion
---
.../org/apache/jorphan/util/ConverterSpec.groovy | 36 ++++++++++++++--------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/src/jorphan/src/test/groovy/org/apache/jorphan/util/ConverterSpec.groovy b/src/jorphan/src/test/groovy/org/apache/jorphan/util/ConverterSpec.groovy
index fa61e33..0c8bc3b 100644
--- a/src/jorphan/src/test/groovy/org/apache/jorphan/util/ConverterSpec.groovy
+++ b/src/jorphan/src/test/groovy/org/apache/jorphan/util/ConverterSpec.groovy
@@ -62,19 +62,25 @@ class ConverterSpec extends Specification {
expect:
Converter.convert(value, type) == expected
where:
- value | type | expected
- 23f | float.class | 23f
- 42f | Float.class | 42f
- "42" | Float.class | 42f
- 23f | double.class | 23d
- 42f | Double.class | 42d
- "42" | Double.class | 42d
- 23L | int.class | 23
- 42 | Integer.class | 42
- "42" | Integer.class | 42
- 23L | long.class | 23L
- 42 | Long.class | 42L
- "42" | Long.class | 42L
+ value | type | expected
+ 23f | float.class | 23f
+ 42f | Float.class | 42f
+ "42" | Float.class | 42f
+ 23f | double.class | 23d
+ 42f | Double.class | 42d
+ "42" | Double.class | 42d
+ 23L | int.class | 23
+ 42 | Integer.class | 42
+ "42" | Integer.class | 42
+ 23L | long.class | 23L
+ 42 | Long.class | 42L
+ "42" | Long.class | 42L
+ "invalid" | Float.class | 0f
+ "invalid" | float.class | 0f
+ "invalid" | double.class | 0d
+ "invalid" | Double.class | 0d
+ "invalid" | int.class | 0
+ "invalid" | Integer.class | 0
}
def "Convert #value to Class gives #expected"() {
@@ -105,6 +111,10 @@ class ConverterSpec extends Specification {
"c" | char.class | 'c'
"char" | char.class | 'c'
65 | char.class | 'A'
+ '' | char.class | ' '
+ Character.valueOf((char) 65) | char.class | 'A'
+ Byte.valueOf((byte)65) | char.class | 'A'
+ new Object() { String toString() {1/0}} | char.class | ' '
}
def "Convert to date from '#value'"() {