mirror of
https://github.com/alibaba/testable-mock.git
synced 2025-02-12 12:50:13 +08:00
Merge pull request #223 from Augustine-C/fix_flaky
Fixed a flaky test in core.tool.OmniAccessorTest
This commit is contained in:
commit
e1afb1cd54
@ -2,6 +2,7 @@ package com.alibaba.testable.core.tool;
|
|||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.alibaba.testable.core.tool.PrivateAccessor.*;
|
import static com.alibaba.testable.core.tool.PrivateAccessor.*;
|
||||||
@ -13,40 +14,43 @@ class OmniAccessorTest {
|
|||||||
void should_generate_member_index() {
|
void should_generate_member_index() {
|
||||||
List<String> index = invokeStatic(OmniAccessor.class, "generateMemberIndex", DemoParent.class);
|
List<String> index = invokeStatic(OmniAccessor.class, "generateMemberIndex", DemoParent.class);
|
||||||
assertEquals(34, index.size());
|
assertEquals(34, index.size());
|
||||||
assertEquals("/c{DemoChild}", index.get(0));
|
HashSet<String> expected = new HashSet<String>(){{
|
||||||
assertEquals("/c{DemoChild}/gc{DemoGrandChild}", index.get(1));
|
add("/c{DemoChild}");
|
||||||
assertEquals("/c{DemoChild}/gc{DemoGrandChild}/i{int}", index.get(2));
|
add("/c{DemoChild}/gc{DemoGrandChild}");
|
||||||
assertEquals("/c{DemoChild}/gc{DemoGrandChild}/l{long}", index.get(3));
|
add("/c{DemoChild}/gc{DemoGrandChild}/i{int}");
|
||||||
assertEquals("/c{DemoChild}/gc{DemoGrandChild}/si{Integer}", index.get(4));
|
add("/c{DemoChild}/gc{DemoGrandChild}/l{long}");
|
||||||
assertEquals("/c{DemoChild}/gc{DemoGrandChild}/sl{Long}", index.get(5));
|
add("/c{DemoChild}/gc{DemoGrandChild}/si{Integer}");
|
||||||
assertEquals("/c{DemoChild}/gcs{DemoGrandChild[]}", index.get(6));
|
add("/c{DemoChild}/gc{DemoGrandChild}/sl{Long}");
|
||||||
assertEquals("/c{DemoChild}/gcs{DemoGrandChild[]}/i{int}", index.get(7));
|
add("/c{DemoChild}/gcs{DemoGrandChild[]}");
|
||||||
assertEquals("/c{DemoChild}/gcs{DemoGrandChild[]}/l{long}", index.get(8));
|
add("/c{DemoChild}/gcs{DemoGrandChild[]}/i{int}");
|
||||||
assertEquals("/c{DemoChild}/gcs{DemoGrandChild[]}/si{Integer}", index.get(9));
|
add("/c{DemoChild}/gcs{DemoGrandChild[]}/l{long}");
|
||||||
assertEquals("/c{DemoChild}/gcs{DemoGrandChild[]}/sl{Long}", index.get(10));
|
add("/c{DemoChild}/gcs{DemoGrandChild[]}/si{Integer}");
|
||||||
assertEquals("/cs{DemoChild[]}", index.get(11));
|
add("/c{DemoChild}/gcs{DemoGrandChild[]}/sl{Long}");
|
||||||
assertEquals("/cs{DemoChild[]}/gc{DemoGrandChild}", index.get(12));
|
add("/cs{DemoChild[]}");
|
||||||
assertEquals("/cs{DemoChild[]}/gc{DemoGrandChild}/i{int}", index.get(13));
|
add("/cs{DemoChild[]}/gc{DemoGrandChild}");
|
||||||
assertEquals("/cs{DemoChild[]}/gc{DemoGrandChild}/l{long}", index.get(14));
|
add("/cs{DemoChild[]}/gc{DemoGrandChild}/i{int}");
|
||||||
assertEquals("/cs{DemoChild[]}/gc{DemoGrandChild}/si{Integer}", index.get(15));
|
add("/cs{DemoChild[]}/gc{DemoGrandChild}/l{long}");
|
||||||
assertEquals("/cs{DemoChild[]}/gc{DemoGrandChild}/sl{Long}", index.get(16));
|
add("/cs{DemoChild[]}/gc{DemoGrandChild}/si{Integer}");
|
||||||
assertEquals("/cs{DemoChild[]}/gcs{DemoGrandChild[]}", index.get(17));
|
add("/cs{DemoChild[]}/gc{DemoGrandChild}/sl{Long}");
|
||||||
assertEquals("/cs{DemoChild[]}/gcs{DemoGrandChild[]}/i{int}", index.get(18));
|
add("/cs{DemoChild[]}/gcs{DemoGrandChild[]}");
|
||||||
assertEquals("/cs{DemoChild[]}/gcs{DemoGrandChild[]}/l{long}", index.get(19));
|
add("/cs{DemoChild[]}/gcs{DemoGrandChild[]}/i{int}");
|
||||||
assertEquals("/cs{DemoChild[]}/gcs{DemoGrandChild[]}/si{Integer}", index.get(20));
|
add("/cs{DemoChild[]}/gcs{DemoGrandChild[]}/l{long}");
|
||||||
assertEquals("/cs{DemoChild[]}/gcs{DemoGrandChild[]}/sl{Long}", index.get(21));
|
add("/cs{DemoChild[]}/gcs{DemoGrandChild[]}/si{Integer}");
|
||||||
assertEquals("/sc{SubChild}", index.get(22));
|
add("/cs{DemoChild[]}/gcs{DemoGrandChild[]}/sl{Long}");
|
||||||
assertEquals("/sc{SubChild}/gc{DemoGrandChild}", index.get(23));
|
add("/sc{SubChild}");
|
||||||
assertEquals("/sc{SubChild}/gc{DemoGrandChild}/i{int}", index.get(24));
|
add("/sc{SubChild}/gc{DemoGrandChild}");
|
||||||
assertEquals("/sc{SubChild}/gc{DemoGrandChild}/l{long}", index.get(25));
|
add("/sc{SubChild}/gc{DemoGrandChild}/i{int}");
|
||||||
assertEquals("/sc{SubChild}/gc{DemoGrandChild}/si{Integer}", index.get(26));
|
add("/sc{SubChild}/gc{DemoGrandChild}/l{long}");
|
||||||
assertEquals("/sc{SubChild}/gc{DemoGrandChild}/sl{Long}", index.get(27));
|
add("/sc{SubChild}/gc{DemoGrandChild}/si{Integer}");
|
||||||
assertEquals("/ssc{StaticSubChild}", index.get(28));
|
add("/sc{SubChild}/gc{DemoGrandChild}/sl{Long}");
|
||||||
assertEquals("/ssc{StaticSubChild}/gc{DemoGrandChild}", index.get(29));
|
add("/ssc{StaticSubChild}");
|
||||||
assertEquals("/ssc{StaticSubChild}/gc{DemoGrandChild}/i{int}", index.get(30));
|
add("/ssc{StaticSubChild}/gc{DemoGrandChild}");
|
||||||
assertEquals("/ssc{StaticSubChild}/gc{DemoGrandChild}/l{long}", index.get(31));
|
add("/ssc{StaticSubChild}/gc{DemoGrandChild}/i{int}");
|
||||||
assertEquals("/ssc{StaticSubChild}/gc{DemoGrandChild}/si{Integer}", index.get(32));
|
add("/ssc{StaticSubChild}/gc{DemoGrandChild}/l{long}");
|
||||||
assertEquals("/ssc{StaticSubChild}/gc{DemoGrandChild}/sl{Long}", index.get(33));
|
add("/ssc{StaticSubChild}/gc{DemoGrandChild}/si{Integer}");
|
||||||
|
add("/ssc{StaticSubChild}/gc{DemoGrandChild}/sl{Long}");
|
||||||
|
}};
|
||||||
|
assertEquals(expected, new HashSet<String>(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user