diff options
author | Arthur Rand <arand@ucsc.edu> | 2018-02-09 14:56:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-09 14:56:49 -0800 |
commit | 3830ddd237c0c538c1d5329377b00ada2eecefdf (patch) | |
tree | 76a482cdc6bded1cf2eb14a3faf603aff8a09577 /src/test/scala | |
parent | db338bd1aeb8175967cc0bdc271317576876633d (diff) | |
parent | ec1d7f92fe23a5d928b4d579f3a49817a939f3c2 (diff) | |
download | driver-core-3830ddd237c0c538c1d5329377b00ada2eecefdf.tar.gz driver-core-3830ddd237c0c538c1d5329377b00ada2eecefdf.tar.bz2 driver-core-3830ddd237c0c538c1d5329377b00ada2eecefdf.zip |
Merge pull request #113 from drivergroup/ar-add-extra-converters-for-optionv1.7.5
related to API-1252, add extra converters for option
Diffstat (limited to 'src/test/scala')
-rw-r--r-- | src/test/scala/xyz/driver/core/database/DatabaseTest.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/scala/xyz/driver/core/database/DatabaseTest.scala b/src/test/scala/xyz/driver/core/database/DatabaseTest.scala index a5c65ea..f85dcad 100644 --- a/src/test/scala/xyz/driver/core/database/DatabaseTest.scala +++ b/src/test/scala/xyz/driver/core/database/DatabaseTest.scala @@ -17,12 +17,27 @@ class DatabaseTest extends FlatSpec with Matchers with Checkers { val validLength = nextInt(10) val valid = nextToken(validLength) + val validOp = Some(valid) val invalid = nextToken(validLength + nextInt(10, 1)) + val invalidOp = Some(invalid) def mapper(s: String): Option[String] = if (s.length == validLength) Some(s) else None TestConverter.fromStringOrThrow(valid, mapper, valid) should be(valid) + TestConverter.expectValid(mapper, valid) should be(valid) + + TestConverter.expectExistsAndValid(mapper, validOp) should be(valid) + + TestConverter.expectValidOrEmpty(mapper, validOp) should be(Some(valid)) + TestConverter.expectValidOrEmpty(mapper, None) should be(None) + an[DatabaseException] should be thrownBy TestConverter.fromStringOrThrow(invalid, mapper, invalid) + + an[DatabaseException] should be thrownBy TestConverter.expectValid(mapper, invalid) + + an[DatabaseException] should be thrownBy TestConverter.expectExistsAndValid(mapper, invalidOp) + + an[DatabaseException] should be thrownBy TestConverter.expectValidOrEmpty(mapper, invalidOp) } } |