Fix flaky testList (#120)

This commit is contained in:
yannizhou05
2022-11-22 18:30:31 -06:00
committed by GitHub
parent ea8834bacd
commit fc9781e6fc

View File

@@ -54,6 +54,7 @@ import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyLong;
@@ -135,8 +136,9 @@ public class TopicControllerTest extends BaseControllerTest {
// 3、filter system topic // 3、filter system topic
requestBuilder = MockMvcRequestBuilders.get(url); requestBuilder = MockMvcRequestBuilders.get(url);
perform = mockMvc.perform(requestBuilder); perform = mockMvc.perform(requestBuilder);
String[] topicString = {"%SYS%system_topic2","common_topic2","%SYS%system_topic1","common_topic1"};
perform.andExpect(status().isOk()) perform.andExpect(status().isOk())
.andExpect(jsonPath("$.data.topicList[2]").value("%SYS%system_topic1")); .andExpect(jsonPath("$.data.topicList").value(containsInAnyOrder(topicString)));
} }
@Test @Test