dependencies: Refactor unit tests without depending on Guava (#2181)

* Refactor unit tests without depending on Guava

* Remove redundant casts.

* Move import up

* Update repository/src/test/java/com/iluwatar/repository/RepositoryTest.java

Co-authored-by: Robert Volkmann <20912167+robertvolkmann@users.noreply.github.com>

* Update repository/src/test/java/com/iluwatar/repository/AnnotationBasedRepositoryTest.java

Co-authored-by: Robert Volkmann <20912167+robertvolkmann@users.noreply.github.com>

Co-authored-by: Ilkka Seppälä <iluwatar@users.noreply.github.com>
Co-authored-by: Robert Volkmann <20912167+robertvolkmann@users.noreply.github.com>
This commit is contained in:
kongleong86
2022-12-04 09:25:57 +00:00
committed by GitHub
parent ce5605b4d5
commit 2d309b8928
11 changed files with 14 additions and 50 deletions
-6
View File
@@ -34,12 +34,6 @@
</parent>
<artifactId>value-object</artifactId>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-testlib</artifactId>
<version>23.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
@@ -24,11 +24,9 @@
*/
package com.iluwatar.value.object;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import com.google.common.testing.EqualsTester;
import org.junit.jupiter.api.Test;
/**
@@ -47,7 +45,7 @@ class HeroStatTest {
void testEquals() {
var heroStatA = HeroStat.valueOf(3, 9, 2);
var heroStatB = HeroStat.valueOf(3, 9, 2);
new EqualsTester().addEqualityGroup(heroStatA, heroStatB).testEquals();
assertEquals(heroStatA, heroStatB);
}
/**
@@ -59,9 +57,8 @@ class HeroStatTest {
var heroStatA = HeroStat.valueOf(3, 9, 2);
var heroStatB = HeroStat.valueOf(3, 9, 2);
var heroStatC = HeroStat.valueOf(3, 9, 8);
assertThat(heroStatA.toString(), is(heroStatB.toString()));
assertThat(heroStatA.toString(), is(not(heroStatC.toString())));
assertEquals(heroStatA.toString(), heroStatB.toString());
assertNotEquals(heroStatA.toString(), heroStatC.toString());
}
}