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 11:25:57 +02:00
committed by GitHub
co-authored by Ilkka Seppälä Robert Volkmann
parent ce5605b4d5
commit 2d309b8928
11 changed files with 14 additions and 50 deletions
@@ -24,6 +24,7 @@
*/
package com.iluwatar.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@@ -36,4 +37,6 @@ public interface PersonRepository
extends CrudRepository<Person, Long>, JpaSpecificationExecutor<Person> {
Person findByName(String name);
List<Person> findAll();
}
@@ -28,7 +28,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.common.collect.Lists;
import java.util.List;
import javax.annotation.Resource;
import org.junit.jupiter.api.AfterEach;
@@ -66,7 +65,7 @@ class AnnotationBasedRepositoryTest {
@Test
void testFindAll() {
var actuals = Lists.newArrayList(repository.findAll());
var actuals = repository.findAll();
assertTrue(actuals.containsAll(persons) && persons.containsAll(actuals));
}
@@ -28,7 +28,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.common.collect.Lists;
import java.util.List;
import javax.annotation.Resource;
import org.junit.jupiter.api.AfterEach;
@@ -66,7 +65,7 @@ class RepositoryTest {
@Test
void testFindAll() {
var actuals = Lists.newArrayList(repository.findAll());
var actuals = repository.findAll();
assertTrue(actuals.containsAll(persons) && persons.containsAll(actuals));
}