Skip to content

Commit b08236a

Browse files
committed
toString() tested only in dedicated test
1 parent 20c874e commit b08236a

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/test/java/redis/clients/jedis/modules/search/DocumentTest.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,8 @@ public void serialize() throws IOException, ClassNotFoundException {
3939

4040
assertEquals(id, read.getId());
4141
assertEquals(score, read.getScore(), 0d);
42-
43-
// use english language to make sure the decimal separator is the same as the toString
44-
String exp1 = String.format(Locale.ENGLISH, "id:%s, score: %.1f, properties:%s",
45-
id, score, "[string=c, float=12.0]");
46-
String exp2 = String.format(Locale.ENGLISH, "id:%s, score: %.1f, properties:%s",
47-
id, score, "[float=12.0, string=c]");
48-
String actual = read.toString();
49-
assertTrue(actual.equals(exp1)||actual.equals(exp2));
5042
assertEquals("c", read.getString("string"));
51-
assertEquals(Double.valueOf(12d), read.get("float"));
43+
assertEquals(12d, read.get("float"));
5244
}
5345

5446
@Test
@@ -65,6 +57,8 @@ public void toStringTest() {
6557
id, score, "[string=c, float=12.0]");
6658
String expected2 = String.format(Locale.ENGLISH, "id:%s, score: %.1f, properties:%s",
6759
id, score, "[float=12.0, string=c]");
60+
61+
// the order of the properties is not guaranteed, so we check both possible outcomes
6862
String actual = document.toString();
6963
assertTrue(actual.equals(expected1)||actual.equals(expected2));
7064
}

0 commit comments

Comments
 (0)