Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade hamcrest from 1.3 to 3.0 #1305

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions geowebcache/arcgiscache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,11 @@
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
Expand Down
10 changes: 0 additions & 10 deletions geowebcache/azureblob/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@
<artifactId>log4j-slf4j-impl</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand All @@ -51,11 +46,6 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
Expand Down
15 changes: 0 additions & 15 deletions geowebcache/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,6 @@
<artifactId>httpclient</artifactId>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-integration</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.emptyString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.isEmptyString;

import java.util.Collections;
import java.util.Map;
Expand All @@ -35,7 +35,7 @@ public class ParametersUtilsTest {
@Test
public void testEmptyToKVP() {
String result = ParametersUtils.getKvp(Collections.emptyMap());
assertThat(result, isEmptyString());
assertThat(result, emptyString());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
import java.util.Map;
import java.util.Set;
import org.easymock.EasyMock;
import org.easymock.IArgumentMatcher;
import org.geowebcache.grid.BoundingBox;
import org.geowebcache.grid.GridSubset;
import org.geowebcache.layer.TileLayer;
import org.geowebcache.mime.ImageMime;
import org.geowebcache.storage.StorageBroker;
import org.hamcrest.integration.EasyMock2Adapter;
import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;
import org.junit.Test;

public class TruncateBboxRequestTest {
Expand All @@ -47,7 +49,7 @@ protected SeedRequest seedRequest(
int maxZ,
BoundingBox bounds,
Map<String, String> parameters) {
EasyMock2Adapter.adapt(
Matcher<Object> matcher =
allOf(
hasProperty("layerName", equalTo(layerName)),
hasProperty("gridSetId", equalTo(gridSet)),
Expand All @@ -58,7 +60,20 @@ protected SeedRequest seedRequest(
hasProperty("filterUpdate", any(Boolean.class)),
hasProperty("threadCount", any(Integer.class)),
hasProperty("bounds", equalTo(bounds)),
hasProperty("type", any(GWCTask.TYPE.class))));
hasProperty("type", any(GWCTask.TYPE.class)));
EasyMock.reportMatcher(
new IArgumentMatcher() {

@Override
public boolean matches(Object argument) {
return matcher.matches(argument);
}

@Override
public void appendTo(StringBuffer buffer) {
matcher.describeTo(new StringDescription(buffer));
}
});
return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit has me confused.. if we return null, is the object being built in the previous step even used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old and new code both return null here. I think that easymock is adding the matcher to a static field so the return value isn't very important. I personally find mockito to be clearer and easier to use even though geoserver uses easymock more.

}

Expand Down
10 changes: 0 additions & 10 deletions geowebcache/diskquota/bdb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
Expand All @@ -46,11 +41,6 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
Expand Down
10 changes: 0 additions & 10 deletions geowebcache/diskquota/jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
Expand All @@ -58,11 +53,6 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
Expand Down
10 changes: 0 additions & 10 deletions geowebcache/mbtiles/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,11 @@
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
Expand Down
35 changes: 31 additions & 4 deletions geowebcache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<commons-text.version>1.12.0</commons-text.version>
<commons-fileupload.version>1.5</commons-fileupload.version>
<guava.version>33.2.1-jre</guava.version>
<hamcrest.version>3.0</hamcrest.version>
<jsr305.version>3.0.1</jsr305.version>
<log4j.version>2.17.2</log4j.version>
<h2.version>1.1.119</h2.version>
Expand Down Expand Up @@ -273,17 +274,29 @@
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>hamcrest-core</artifactId>
<groupId>org.hamcrest</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<artifactId>hamcrest</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-integration</artifactId>
<version>1.3</version>
<artifactId>hamcrest-core</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -470,6 +483,20 @@
</dependencies>
</dependencyManagement>

<!-- common test dependencies -->
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<repositories>
<repository>
<releases>
Expand Down
10 changes: 0 additions & 10 deletions geowebcache/rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geowebcache</groupId>
<artifactId>gwc-core</artifactId>
Expand All @@ -57,11 +52,6 @@
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
10 changes: 0 additions & 10 deletions geowebcache/s3storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand All @@ -53,11 +48,6 @@
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.findify</groupId>
<artifactId>s3mock_2.12</artifactId>
Expand Down
10 changes: 0 additions & 10 deletions geowebcache/sqlite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
Expand Down
10 changes: 0 additions & 10 deletions geowebcache/web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
Expand All @@ -133,11 +128,6 @@
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-legacy</artifactId>
Expand Down
10 changes: 0 additions & 10 deletions geowebcache/wms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand All @@ -67,11 +62,6 @@
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geowebcache</groupId>
<artifactId>gwc-core</artifactId>
Expand Down
Loading
Loading