JUnit5 順番を無視して配列が一致するか

JUnit5 + hamcrest

plugins {
    id 'java'
}
 
apply plugin: 'application'
mainClassName = 'com.example.sql_practice.Main'
 
group 'com.example'
version '1.0-SNAPSHOT'
 
tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}
 
repositories {
    jcenter()
    mavenCentral()
}
 
dependencies {
    compile group: 'org.postgresql', name: 'postgresql', version: '42.0.0'
    testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2'
    testImplementation 'org.hamcrest:hamcrest:2.2'
}
 
test {
    // print to stdout
    testLogging {
        showStandardStreams true
    }
    useJUnitPlatform()
}

順番を無視して配列が一致するか

 
var m1 = new Movie(1, "天気の子", "アニメ", 2019, 141.9);
var m2 = new Movie(1, "天気の子", "アニメ", 2019, 141.9);
var a1 = List.of(m1, m2);
var a2 = List.of(m2, m1);
System.out.println(a1.equals(a2));
System.out.println(a1.containsAll(a2));
System.out.println(arrayContaining(a1).matches(a2));
System.out.println(equalTo(a1).matches(a2));
/*
true
true
false
true
*/