@@ -29,7 +29,9 @@ import org.scalacheck.{Arbitrary, Gen}
2929class StringSyntaxTests extends MouseSuite {
3030 test(" StringOps.parseInt" ) {
3131 assertEquals(" 123" .parseInt, 123 .asRight[NumberFormatException ])
32- assertEquals(" blah" .parseInt.leftMap(_.getMessage), " For input string: \" blah\" " .asLeft)
32+ assertEquals(" blah" .parseInt.leftMap(_.getMessage.replace(" string " , " string: " )),
33+ " For input string: \" blah\" " .asLeft
34+ )
3335 }
3436
3537 property(" scalacheck-suite: StringOps.parseInt" ) {
@@ -48,7 +50,9 @@ class StringSyntaxTests extends MouseSuite {
4850
4951 test(" StringOps.parseLong" ) {
5052 assertEquals(" 123" .parseLong, 123L .asRight[NumberFormatException ])
51- assertEquals(" blah" .parseLong.leftMap(_.getMessage), " For input string: \" blah\" " .asLeft)
53+ assertEquals(" blah" .parseLong.leftMap(_.getMessage.replace(" string " , " string: " )),
54+ " For input string: \" blah\" " .asLeft
55+ )
5256 }
5357
5458 property(" scalacheck-suite: StringOps.parseLong" ) {
@@ -67,7 +71,9 @@ class StringSyntaxTests extends MouseSuite {
6771
6872 test(" StringOps.parseShort" ) {
6973 assertEquals(" 123" .parseShort, 123 .toShort.asRight[NumberFormatException ])
70- assertEquals(" blah" .parseShort.leftMap(_.getMessage), " For input string: \" blah\" " .asLeft)
74+ assertEquals(" blah" .parseShort.leftMap(_.getMessage.replace(" string " , " string: " )),
75+ " For input string: \" blah\" " .asLeft
76+ )
7177 }
7278
7379 property(" scalacheck-suite: StringOps.parseShort" ) {
@@ -86,7 +92,9 @@ class StringSyntaxTests extends MouseSuite {
8692
8793 test(" StringOps.parseDouble" ) {
8894 assertEquals(" 123.1" .parseDouble, 123.1 .asRight[NumberFormatException ])
89- assertEquals(" blah" .parseDouble.leftMap(_.getMessage), " For input string: \" blah\" " .asLeft)
95+ assertEquals(" blah" .parseDouble.leftMap(_.getMessage.replace(" string " , " string: " )),
96+ " For input string: \" blah\" " .asLeft
97+ )
9098 }
9199
92100 property(" scalacheck-suite: StringOps.parseDouble" ) {
@@ -104,7 +112,9 @@ class StringSyntaxTests extends MouseSuite {
104112 }
105113
106114 test(" StringOps.parseFloat" ) {
107- assertEquals(" blah" .parseFloat.leftMap(_.getMessage), " For input string: \" blah\" " .asLeft)
115+ assertEquals(" blah" .parseFloat.leftMap(_.getMessage.replace(" string " , " string: " )),
116+ " For input string: \" blah\" " .asLeft
117+ )
108118 }
109119
110120 property(" scalacheck-suite: StringOps.parseFloat" ) {
@@ -123,7 +133,9 @@ class StringSyntaxTests extends MouseSuite {
123133
124134 test(" StringOps.parseByte" ) {
125135 assertEquals(" 123" .parseByte, 123 .toByte.asRight[NumberFormatException ])
126- assertEquals(" blah" .parseByte.leftMap(_.getMessage), " For input string: \" blah\" " .asLeft)
136+ assertEquals(" blah" .parseByte.leftMap(_.getMessage.replace(" string " , " string: " )),
137+ " For input string: \" blah\" " .asLeft
138+ )
127139 }
128140
129141 property(" scalacheck-suite: StringOps.parseByte" ) {
@@ -142,7 +154,9 @@ class StringSyntaxTests extends MouseSuite {
142154
143155 test(" StringOps.parseBigInt" ) {
144156 assertEquals(" 123" .parseBigInt, BigInt (" 123" ).asRight[NumberFormatException ])
145- assertEquals(" blah" .parseBigInt.leftMap(_.getMessage), " For input string: \" blah\" " .asLeft)
157+ assertEquals(" blah" .parseBigInt.leftMap(_.getMessage.replace(" string " , " string: " )),
158+ " For input string: \" blah\" " .asLeft
159+ )
146160 }
147161
148162 property(" scalacheck-suite: StringOps.parseBigInt" ) {
@@ -196,7 +210,9 @@ class StringSyntaxTests extends MouseSuite {
196210 Arbitrary .arbString.arbitrary.filter(s => ! s.equalsIgnoreCase(" true" ) && ! s.equalsIgnoreCase(" false" ))
197211
198212 forAll(stringGen) { (s : String ) =>
199- assertEquals(s.parseBoolean.leftMap(_.getMessage), (" For input string: \" " + s + " \" " ).asLeft)
213+ assertEquals(s.parseBoolean.leftMap(_.getMessage.replace(" string " , " string: " )),
214+ (" For input string: \" " + s + " \" " ).asLeft
215+ )
200216 }
201217 }
202218
0 commit comments