Skip to content

Commit

Permalink
Merge pull request #989 from KingOfSquares/remove-ugly-assertion
Browse files Browse the repository at this point in the history
Use EqualsTester instead of weird equality assertion
  • Loading branch information
kashike authored Oct 23, 2023
2 parents f0735a5 + cef8036 commit 051f719
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
*/
package net.kyori.adventure.text.title;

import com.google.common.testing.EqualsTester;
import java.time.Duration;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.title.Title;
import net.kyori.adventure.title.TitlePart;
import net.kyori.test.EqualityAssertions;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -85,6 +85,11 @@ void testEquality() {
final Title notEqualTitle = Title.title(Component.text("cat"), Component.text("bar"), Title.Times.times(Duration.ofMillis(500), Duration.ofMillis(1000), Duration.ofMillis(1500)));
final Title notEqualTimes = Title.title(Component.text("foo"), Component.text("bar"), Title.Times.times(Duration.ofMillis(499), Duration.ofMillis(1000), Duration.ofMillis(1500)));

EqualityAssertions.assertEqualityAndNonEquality(title, equalTitle, notEqualSubtitle, notEqualTitle, notEqualTimes);
new EqualsTester()
.addEqualityGroup(title, equalTitle)
.addEqualityGroup(notEqualSubtitle)
.addEqualityGroup(notEqualTitle)
.addEqualityGroup(notEqualTimes)
.testEquals();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
*/
package net.kyori.adventure.text.title;

import com.google.common.testing.EqualsTester;
import java.time.Duration;
import net.kyori.adventure.title.Title;
import org.junit.jupiter.api.Test;

import static net.kyori.test.EqualityAssertions.assertEqualityAndNonEquality;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class TitleTimesTest {
Expand All @@ -52,6 +52,11 @@ void testEquality() {
final Title.Times notEqualStay = Title.Times.times(Duration.ofMillis(1000), Duration.ofMillis(2001), Duration.ofMillis(1234));
final Title.Times notEqualFadeOut = Title.Times.times(Duration.ofMillis(1000), Duration.ofMillis(2000), Duration.ofMillis(1235));

assertEqualityAndNonEquality(times, equalTimes, notEqualFadeIn, notEqualStay, notEqualFadeOut);
new EqualsTester()
.addEqualityGroup(times, equalTimes)
.addEqualityGroup(notEqualFadeIn)
.addEqualityGroup(notEqualStay)
.addEqualityGroup(notEqualFadeOut)
.testEquals();
}
}
50 changes: 0 additions & 50 deletions api/src/test/java/net/kyori/test/EqualityAssertions.java

This file was deleted.

0 comments on commit 051f719

Please sign in to comment.