1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

fix a flaky test

This commit is contained in:
Hao Wang 2021-07-18 21:20:38 -07:00
parent 8c0ef8a97f
commit 077cd22b99
2 changed files with 10 additions and 2 deletions

View File

@ -367,6 +367,12 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<!-- Shaded packages --> <!-- Shaded packages -->
<dependency> <dependency>

View File

@ -3,6 +3,7 @@ package io.github.thebusybiscuit.slimefun4.api.items.settings;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.HashSet;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Tag; import org.bukkit.Tag;
@ -11,6 +12,7 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
@ -68,7 +70,7 @@ class TestMaterialTagSetting {
item.register(plugin); item.register(plugin);
List<String> tagContents = tag.getValues().stream().map(Material::name).collect(Collectors.toList()); List<String> tagContents = tag.getValues().stream().map(Material::name).collect(Collectors.toList());
Assertions.assertIterableEquals(tagContents, setting.getValue()); assertThat("Two list is different", new HashSet<>(tagContents).equals(new HashSet<>(setting.getValue())));
List<String> materials = Arrays.asList(Material.REDSTONE.name(), Material.DIAMOND.name()); List<String> materials = Arrays.asList(Material.REDSTONE.name(), Material.DIAMOND.name());
setting.update(materials); setting.update(materials);