标题说明一切,找出集合是否包含其他集合的任何元素的最佳实践是什么?
在java中我会像这样执行它
CollectionUtils.containsAny(a, b)
Run Code Online (Sandbox Code Playgroud)
使用常见的apache collection utils,其中变量a/b是集合.
如何在scala中实现此行为?或者是否有像上面的CollectionUtils这样的库?
我不想使用common-apache库,因为我必须将scala集合转换为java集合.
我在进行以下集成测试时遇到问题
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
@SpringBootTest
@ActiveProfiles("test")
@TestMethodOrder(OrderAnnotation.classs)
public class FooServiceIT {
@Test
@Order(1)
void testUploadSuccess() { ... }
@Test
@Order(2)
void testDownloadSuccess() { ... }
@Test
@Order(3)
void testDeleteSuccess() { ... }
}
Run Code Online (Sandbox Code Playgroud)
我希望在运行测试时执行顺序为1、2、3,但是由于某种原因,实际的执行顺序为2、3、1。
Tbh,我不知道为什么注释不起作用。我正在将Spring Boot 2.1.3与JUnit 5.4一起使用。