File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
gson/src/test/java/com/google/gson/functional Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 3838import java .util .EnumSet ;
3939import java .util .Map ;
4040import java .util .Set ;
41+ import java .util .HashSet ;
4142import org .junit .Before ;
4243import org .junit .Test ;
4344
@@ -93,7 +94,7 @@ public void testCollectionOfEnumsDeserialization() {
9394 @ Test
9495 public void testClassWithEnumFieldSerialization () {
9596 ClassWithEnumFields target = new ClassWithEnumFields ();
96- assertThat (gson .toJson (target )). isEqualTo ( target . getExpectedJson ()) ;
97+ assertThat (target . getExpectedJson (). contains ( gson .toJson (target ))). isTrue (); ;
9798 }
9899
99100 @ Test
@@ -111,9 +112,12 @@ private static enum MyEnum {
111112 private static class ClassWithEnumFields {
112113 private final MyEnum value1 = MyEnum .VALUE1 ;
113114 private final MyEnum value2 = MyEnum .VALUE2 ;
114- public String getExpectedJson () {
115- return "{\" value1\" :\" " + value1 + "\" ,\" value2\" :\" " + value2 + "\" }" ;
116- }
115+ public Set <String > getExpectedJson () {
116+ Set <String > possiblejsonvalues = new HashSet <String >();
117+ possiblejsonvalues .add ("{\" value1\" :\" " + value1 + "\" ,\" value2\" :\" " + value2 + "\" }" );
118+ possiblejsonvalues .add ("{\" value2\" :\" " + value2 + "\" ,\" value1\" :\" " + value1 + "\" }" );
119+ return possiblejsonvalues ;
120+ }
117121 }
118122
119123 /**
You can’t perform that action at this time.
0 commit comments