Skip to content

Commit

Permalink
Use simpler and better JUnit APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jan 18, 2025
1 parent 0740b23 commit ac80287
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 41 deletions.
5 changes: 0 additions & 5 deletions commons-jcs3-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions commons-jcs3-jcache-extras/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions commons-jcs3-jcache-openjpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
*/
package org.apache.commons.jcs3.jcache.openjpa;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand Down Expand Up @@ -99,8 +98,8 @@ void testEntity()
em.getTransaction().commit();
assertNotNull(conf.getDataCacheManagerInstance().getDataCache("default"));

assertThat(conf.getDataCacheManagerInstance(), instanceOf(OpenJPAJCacheDataCacheManager.class));
assertThat(conf.getDataCacheManagerInstance().getDataCache("default"), instanceOf(OpenJPAJCacheDataCache.class));
assertInstanceOf(OpenJPAJCacheDataCacheManager.class, conf.getDataCacheManagerInstance());
assertInstanceOf(OpenJPAJCacheDataCache.class, conf.getDataCacheManagerInstance().getDataCache("default"));
assertTrue(conf.getDataCacheManagerInstance().getDataCache("default").contains(JPAFacadeHelper.toOpenJPAObjectId(conf.getMetaDataRepositoryInstance().getCachedMetaData(MyEntity.class), entity.getId())));

em.close();
Expand All @@ -124,8 +123,8 @@ void testQuery()
assertEquals(1, query.setParameter("id", entity.getId()).getResultList().size());
assertNotNull(conf.getDataCacheManagerInstance().getDataCache("default"));

assertThat(conf.getDataCacheManagerInstance(), instanceOf(OpenJPAJCacheDataCacheManager.class));
assertThat(conf.getDataCacheManagerInstance().getDataCache("default"), instanceOf(OpenJPAJCacheDataCache.class));
assertInstanceOf(OpenJPAJCacheDataCacheManager.class, conf.getDataCacheManagerInstance());
assertInstanceOf(OpenJPAJCacheDataCache.class, conf.getDataCacheManagerInstance().getDataCache("default"));
assertTrue(conf.getDataCacheManagerInstance().getDataCache("default").contains(JPAFacadeHelper.toOpenJPAObjectId(conf.getMetaDataRepositoryInstance().getCachedMetaData(MyEntity.class), entity.getId())));

final Map<Object, Object> args = Map.of("id", entity.getId());
Expand Down
5 changes: 0 additions & 5 deletions commons-jcs3-jcache-tck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>commons-jcs3-jcache</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
*/
package org.apache.commons.jcs3.jcache;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Iterator;
Expand All @@ -39,7 +38,7 @@ void testCheckOWBProvider()
try {
final Iterator<BeanProvider> iterator = ServiceLoader.load(BeanProvider.class).iterator();
assertTrue(iterator.hasNext());
assertThat(iterator.next(), instanceOf(OWBBeanProvider.class));
assertInstanceOf(OWBBeanProvider.class, iterator.next());
} catch (final java.lang.UnsupportedClassVersionError e) {
System.err.println("Ignoring checkOWBProvider test failure on " + System.getProperty("java.version"));
}
Expand Down
5 changes: 0 additions & 5 deletions commons-jcs3-jcache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
7 changes: 0 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,6 @@
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down Expand Up @@ -560,7 +554,6 @@

<test.type>Unit</test.type>
<doclint>none</doclint>
<hamcrest.version>3.0</hamcrest.version>
<!-- project.build.outputTimestamp is managed by Maven plugins, see https://maven.apache.org/guides/mini/guide-reproducible-builds.html -->
<project.build.outputTimestamp>2022-01-01T00:00:00Z</project.build.outputTimestamp>
</properties>
Expand Down

0 comments on commit ac80287

Please sign in to comment.