[LANG-1514] make test more stable by using HashSet to compare

This commit is contained in:
contextshuffling 2020-01-19 23:00:06 +08:00
parent a606a0328b
commit 4b11c764e5
1 changed files with 2 additions and 1 deletions

View File

@ -36,6 +36,7 @@
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
@ -188,7 +189,7 @@ public void testGetAllFieldsList() {
final List<Field> fieldsInteger = Arrays.asList(Integer.class.getDeclaredFields());
final List<Field> allFieldsInteger = new ArrayList<>(fieldsInteger);
allFieldsInteger.addAll(fieldsNumber);
assertEquals(allFieldsInteger, FieldUtils.getAllFieldsList(Integer.class));
assertEquals(new HashSet(allFieldsInteger), new HashSet(FieldUtils.getAllFieldsList(Integer.class)));
final List<Field> allFields = FieldUtils.getAllFieldsList(PublicChild.class);
// Under Jacoco,0.8.1 and Java 10, the field count is 7.
int expected = 5;