diff --git a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/XMLConfigurationLayerConformanceWithArcGisLayersTest.java b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/XMLConfigurationLayerConformanceWithArcGisLayersTest.java index 127fc7e1d..d2cd971fe 100644 --- a/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/XMLConfigurationLayerConformanceWithArcGisLayersTest.java +++ b/geowebcache/arcgiscache/src/test/java/org/geowebcache/arcgis/layer/XMLConfigurationLayerConformanceWithArcGisLayersTest.java @@ -16,7 +16,7 @@ import static org.geowebcache.util.TestUtils.isPresent; import static org.hamcrest.Matchers.hasProperty; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.io.File; import java.io.IOException; diff --git a/geowebcache/core/src/test/java/org/geowebcache/GeoWebCacheDispatcherTest.java b/geowebcache/core/src/test/java/org/geowebcache/GeoWebCacheDispatcherTest.java index baa52a11e..17f657ce4 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/GeoWebCacheDispatcherTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/GeoWebCacheDispatcherTest.java @@ -15,7 +15,7 @@ package org.geowebcache; import static org.geowebcache.TestHelpers.hasStatus; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.util.Collections; import javax.servlet.http.HttpServletResponse; diff --git a/geowebcache/core/src/test/java/org/geowebcache/GeoWebCacheExtensionsTest.java b/geowebcache/core/src/test/java/org/geowebcache/GeoWebCacheExtensionsTest.java index 22b22a398..c2f96e917 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/GeoWebCacheExtensionsTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/GeoWebCacheExtensionsTest.java @@ -4,12 +4,12 @@ import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.verify; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.util.HashMap; diff --git a/geowebcache/core/src/test/java/org/geowebcache/MockExtensionRuleTest.java b/geowebcache/core/src/test/java/org/geowebcache/MockExtensionRuleTest.java index 02b6bb7b5..e7803203a 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/MockExtensionRuleTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/MockExtensionRuleTest.java @@ -14,11 +14,11 @@ */ package org.geowebcache; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.sameInstance; -import static org.junit.Assert.assertThat; import java.util.Collection; import org.hamcrest.Matchers; diff --git a/geowebcache/core/src/test/java/org/geowebcache/blobstore/file/FileBlobStoreComformanceTest.java b/geowebcache/core/src/test/java/org/geowebcache/blobstore/file/FileBlobStoreComformanceTest.java index 5a8cc206e..0eb80143a 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/blobstore/file/FileBlobStoreComformanceTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/blobstore/file/FileBlobStoreComformanceTest.java @@ -14,9 +14,9 @@ */ package org.geowebcache.blobstore.file; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertThat; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; diff --git a/geowebcache/core/src/test/java/org/geowebcache/config/BlobStoreConfigurationTest.java b/geowebcache/core/src/test/java/org/geowebcache/config/BlobStoreConfigurationTest.java index 45bbacbd7..3d32daa9b 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/config/BlobStoreConfigurationTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/config/BlobStoreConfigurationTest.java @@ -19,13 +19,14 @@ import static org.easymock.EasyMock.verify; import static org.geowebcache.util.TestUtils.isPresent; import static org.geowebcache.util.TestUtils.notPresent; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.arrayContainingInAnyOrder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasProperty; -import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.sameInstance; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThrows; import java.io.IOException; import java.util.Collection; @@ -36,6 +37,7 @@ import org.easymock.IMocksControl; import org.geowebcache.GeoWebCacheException; import org.geowebcache.storage.UnsuitableStorageException; +import org.hamcrest.CoreMatchers; import org.junit.Test; public abstract class BlobStoreConfigurationTest @@ -87,10 +89,8 @@ public void testRollBackOnUnsuitableStorageExceptionInAddHandler() throws Except expectLastCall().andThrow(new UnsuitableStorageException("TEST")); EasyMock.replay(listener); config.addBlobStoreListener(listener); - exception.expect(instanceOf(ConfigurationPersistenceException.class)); - exception.expectCause(instanceOf(UnsuitableStorageException.class)); try { - config.addBlobStore(info); + assertThrows(ConfigurationPersistenceException.class, () -> config.addBlobStore(info)); } finally { verify(listener); assertThat(config.getBlobStore("test"), notPresent()); @@ -109,10 +109,11 @@ public void testRollBackOnUnsuitableStorageExceptionInModifyHandler() throws Exc EasyMock.replay(listener); config.addBlobStoreListener(listener); config.addBlobStore(info1); - exception.expect(instanceOf(ConfigurationPersistenceException.class)); - exception.expectCause(instanceOf(UnsuitableStorageException.class)); try { config.modifyBlobStore(info2); + } catch (ConfigurationPersistenceException expected) { + assertThat( + expected.getCause(), CoreMatchers.instanceOf(UnsuitableStorageException.class)); } finally { verify(listener); assertThat(config.getBlobStore("test"), isPresent(infoEquals(info1))); @@ -142,10 +143,10 @@ public void testRollBackOnSupressedUnsuitableStorageExceptionInModifyHandler() config.addBlobStoreListener(listener1); config.addBlobStoreListener(listener2); config.addBlobStore(info1); - exception.expect(instanceOf(ConfigurationPersistenceException.class)); - exception.expectCause(instanceOf(IOException.class)); try { config.modifyBlobStore(info2); + } catch (ConfigurationPersistenceException expected) { + assertThat(expected.getCause(), CoreMatchers.instanceOf(IOException.class)); } finally { control.verify(); assertThat(config.getBlobStore("test"), isPresent(infoEquals(info1))); @@ -168,10 +169,10 @@ public void testRollBackOnSupressedUnsuitableStorageExceptionInAddHandler() thro control.replay(); config.addBlobStoreListener(listener1); config.addBlobStoreListener(listener2); - exception.expect(instanceOf(ConfigurationPersistenceException.class)); - exception.expectCause(instanceOf(IOException.class)); try { config.addBlobStore(info1); + } catch (ConfigurationPersistenceException expected) { + assertThat(expected.getCause(), CoreMatchers.instanceOf(IOException.class)); } finally { control.verify(); assertThat(config.getBlobStore("test"), notPresent()); @@ -464,12 +465,11 @@ public void testExceptionInAddListenerIsWrapped() throws Exception { EasyMock.expectLastCall().andThrow(ex); EasyMock.replay(listener); - exception.expect( - allOf( - instanceOf(ConfigurationPersistenceException.class), - hasProperty("cause", sameInstance(ex)))); - - this.addInfo(this.config, goodInfo); + try { + this.addInfo(this.config, goodInfo); + } catch (ConfigurationPersistenceException expected) { + assertSame(ex, ex.getCause()); + } } @Test @@ -537,21 +537,22 @@ public void testExceptionInAddListenerRecordsSuppressedExceptions() throws Excep EasyMock.replay(listener1, listener2); - exception.expect( - allOf( - instanceOf(ConfigurationPersistenceException.class), - hasProperty( - "cause", - allOf( - sameInstance(ex2), - hasProperty( - "suppressed", - arrayContainingInAnyOrder(sameInstance(ex1))))))); - - this.addInfo(this.config, goodInfo); + try { + this.addInfo(this.config, goodInfo); + } catch (ConfigurationPersistenceException expected) { + assertThat( + expected, + hasProperty( + "cause", + allOf( + sameInstance(ex2), + hasProperty( + "suppressed", + arrayContainingInAnyOrder(sameInstance(ex1)))))); + } } - // Exceptions during modify handlers + // Exceptions during modify handlers @Test public void testExceptionInModifyListenerIsWrapped() throws Exception { BlobStoreConfigurationListener listener = @@ -564,12 +565,11 @@ public void testExceptionInModifyListenerIsWrapped() throws Exception { EasyMock.expectLastCall().andThrow(ex); EasyMock.replay(listener); - exception.expect( - allOf( - instanceOf(ConfigurationPersistenceException.class), - hasProperty("cause", sameInstance(ex)))); - - this.modifyInfo(this.config, goodInfo); + try { + this.modifyInfo(this.config, goodInfo); + } catch (ConfigurationPersistenceException expected) { + assertThat(expected, hasProperty("cause", sameInstance(ex))); + } } /** @@ -650,18 +650,19 @@ public void testExceptionInModifyListenerRecordsSuppressedExceptions() throws Ex EasyMock.replay(listener1, listener2); - exception.expect( - allOf( - instanceOf(ConfigurationPersistenceException.class), - hasProperty( - "cause", - allOf( - sameInstance(ex2), - hasProperty( - "suppressed", - arrayContainingInAnyOrder(sameInstance(ex1))))))); - - this.modifyInfo(this.config, goodInfo); + try { + this.modifyInfo(this.config, goodInfo); + } catch (ConfigurationPersistenceException expected) { + assertThat( + expected, + hasProperty( + "cause", + allOf( + sameInstance(ex2), + hasProperty( + "suppressed", + arrayContainingInAnyOrder(sameInstance(ex1)))))); + } } // Exceptions during rename handlers @@ -689,12 +690,11 @@ public void testExceptionInRenameListenerIsWrapped() throws Exception { EasyMock.expectLastCall().andThrow(ex); EasyMock.replay(listener); - exception.expect( - allOf( - instanceOf(ConfigurationPersistenceException.class), - hasProperty("cause", sameInstance(ex)))); - - this.renameInfo(this.config, "test", "test2"); + try { + this.renameInfo(this.config, "test", "test2"); + } catch (ConfigurationPersistenceException expected) { + assertThat(expected, hasProperty("cause", sameInstance(ex))); + } } @Test @@ -763,18 +763,19 @@ public void testExceptionInRenameListenerRecordsSuppressedExceptions() throws Ex EasyMock.replay(listener1, listener2); - exception.expect( - allOf( - instanceOf(ConfigurationPersistenceException.class), - hasProperty( - "cause", - allOf( - sameInstance(ex2), - hasProperty( - "suppressed", - arrayContainingInAnyOrder(sameInstance(ex1))))))); - - this.renameInfo(this.config, "test", "test2"); + try { + this.renameInfo(this.config, "test", "test2"); + } catch (ConfigurationPersistenceException expected) { + assertThat( + expected, + hasProperty( + "cause", + allOf( + sameInstance(ex2), + hasProperty( + "suppressed", + arrayContainingInAnyOrder(sameInstance(ex1)))))); + } } // Exceptions during remove handlers @@ -802,12 +803,11 @@ public void testExceptionInRemoveListenerIsWrapped() throws Exception { EasyMock.expectLastCall().andThrow(ex); EasyMock.replay(listener); - exception.expect( - allOf( - instanceOf(ConfigurationPersistenceException.class), - hasProperty("cause", sameInstance(ex)))); - - this.removeInfo(this.config, "test"); + try { + this.removeInfo(this.config, "test"); + } catch (ConfigurationPersistenceException expected) { + assertThat(expected, hasProperty("cause", sameInstance(ex))); + } } @Test @@ -876,17 +876,18 @@ public void testExceptionInRemoveListenerRecordsSuppressedExceptions() throws Ex EasyMock.replay(listener1, listener2); - exception.expect( - allOf( - instanceOf(ConfigurationPersistenceException.class), - hasProperty( - "cause", - allOf( - sameInstance(ex2), - hasProperty( - "suppressed", - arrayContainingInAnyOrder(sameInstance(ex1))))))); - - this.removeInfo(this.config, "test"); + try { + this.removeInfo(this.config, "test"); + } catch (ConfigurationPersistenceException expected) { + assertThat( + expected, + hasProperty( + "cause", + allOf( + sameInstance(ex2), + hasProperty( + "suppressed", + arrayContainingInAnyOrder(sameInstance(ex1)))))); + } } } diff --git a/geowebcache/core/src/test/java/org/geowebcache/config/ConfigurationTest.java b/geowebcache/core/src/test/java/org/geowebcache/config/ConfigurationTest.java index 10bcdc840..502500afa 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/config/ConfigurationTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/config/ConfigurationTest.java @@ -18,11 +18,11 @@ import static org.geowebcache.util.TestUtils.isPresent; import static org.geowebcache.util.TestUtils.notPresent; import static org.geowebcache.util.TestUtils.requirePresent; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.not; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertThrows; import java.util.ArrayList; import java.util.Collection; @@ -37,16 +37,12 @@ import org.hamcrest.Matcher; import org.junit.After; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public abstract class ConfigurationTest { protected C config; - @Rule public ExpectedException exception = ExpectedException.none(); - @Before public void setUpTestUnit() throws Exception { config = getConfig(); @@ -82,11 +78,7 @@ public void testDoubleAddException() throws Exception { I doubleGridSet = getGoodInfo("test", 2); assertThat("Invalid test", goodGridSet, not(infoEquals(doubleGridSet))); addInfo(config, goodGridSet); - exception.expect( - instanceOf( - IllegalArgumentException - .class)); // May want to change to something more specific. - addInfo(config, doubleGridSet); + assertThrows(IllegalArgumentException.class, () -> addInfo(config, doubleGridSet)); } @Test @@ -107,9 +99,7 @@ public void testDoubleAddNoChange() throws Exception { @Test public void testAddBadInfoException() throws Exception { I badGridSet = getBadInfo("test", 1); - exception.expect( - IllegalArgumentException.class); // May want to change to something more specific. - addInfo(config, badGridSet); + assertThrows(IllegalArgumentException.class, () -> addInfo(config, badGridSet)); } @Test @@ -154,8 +144,8 @@ public void testGetNotExists() throws Exception { @Test public void testRemoveNotExists() throws Exception { - exception.expect(NoSuchElementException.class); - removeInfo(config, "GridSetThatDoesntExist"); + assertThrows( + NoSuchElementException.class, () -> removeInfo(config, "GridSetThatDoesntExist")); } @Test @@ -173,9 +163,7 @@ public void testModifyBadGridSetException() throws Exception { testAdd(); I badGridSet = getBadInfo("test", 2); - exception.expect(IllegalArgumentException.class); // Could be more specific - - modifyInfo(config, badGridSet); + assertThrows(IllegalArgumentException.class, () -> modifyInfo(config, badGridSet)); } @Test @@ -211,8 +199,7 @@ public void testPersistModify() throws Exception { @Test public void testModifyNotExistsExcpetion() throws Exception { I goodGridSet = getGoodInfo("test", 2); - exception.expect(NoSuchElementException.class); - modifyInfo(config, goodGridSet); + assertThrows(NoSuchElementException.class, () -> modifyInfo(config, goodGridSet)); } @Test @@ -303,10 +290,10 @@ public void testNoChangeOnPersistExceptionOnAdd() throws Exception { // Force a failure failNextWrite(); - exception.expect(ConfigurationPersistenceException.class); try { - addInfo(config, goodGridSet); + assertThrows( + ConfigurationPersistenceException.class, () -> addInfo(config, goodGridSet)); } finally { // Should be unchanged Optional retrieved = getInfo(config, "test"); diff --git a/geowebcache/core/src/test/java/org/geowebcache/config/DefaultGridsetsConfigurationGridsetConformanceTest.java b/geowebcache/core/src/test/java/org/geowebcache/config/DefaultGridsetsConfigurationGridsetConformanceTest.java index da30357b0..e20053eac 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/config/DefaultGridsetsConfigurationGridsetConformanceTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/config/DefaultGridsetsConfigurationGridsetConformanceTest.java @@ -14,8 +14,8 @@ */ package org.geowebcache.config; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; import org.geowebcache.grid.GridSet; import org.hamcrest.CustomMatcher; diff --git a/geowebcache/core/src/test/java/org/geowebcache/config/GridSetConfigurationTest.java b/geowebcache/core/src/test/java/org/geowebcache/config/GridSetConfigurationTest.java index 1c7737764..9e71c2de4 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/config/GridSetConfigurationTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/config/GridSetConfigurationTest.java @@ -14,8 +14,8 @@ */ package org.geowebcache.config; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; import java.util.Collection; import java.util.Optional; diff --git a/geowebcache/core/src/test/java/org/geowebcache/config/LayerConfigurationTest.java b/geowebcache/core/src/test/java/org/geowebcache/config/LayerConfigurationTest.java index 99fc1a465..b25d49ef3 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/config/LayerConfigurationTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/config/LayerConfigurationTest.java @@ -14,8 +14,8 @@ */ package org.geowebcache.config; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; import java.util.Collection; import java.util.Optional; diff --git a/geowebcache/core/src/test/java/org/geowebcache/config/ServerConfigurationTest.java b/geowebcache/core/src/test/java/org/geowebcache/config/ServerConfigurationTest.java index 3cf82ca5b..bca5a1a94 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/config/ServerConfigurationTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/config/ServerConfigurationTest.java @@ -14,12 +14,12 @@ */ package org.geowebcache.config; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasProperty; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.io.File; diff --git a/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationConstructorsTest.java b/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationConstructorsTest.java index 29ddcd7bd..b73f576fb 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationConstructorsTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationConstructorsTest.java @@ -21,7 +21,7 @@ import static org.easymock.EasyMock.verify; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.io.File; import java.io.IOException; diff --git a/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationLayerConformanceTest.java b/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationLayerConformanceTest.java index 74bad83fd..a24fbf87d 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationLayerConformanceTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationLayerConformanceTest.java @@ -15,8 +15,8 @@ package org.geowebcache.config; import static org.geowebcache.util.TestUtils.isPresent; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasProperty; -import static org.junit.Assert.assertThat; import java.io.File; import java.io.IOException; diff --git a/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationTest.java b/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationTest.java index 6425918fa..acc23732e 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationTest.java @@ -17,6 +17,7 @@ import static org.easymock.EasyMock.createMock; import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; @@ -27,7 +28,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; diff --git a/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationXSchemaTest.java b/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationXSchemaTest.java index 65ad939cb..40683eeec 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationXSchemaTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/config/XMLConfigurationXSchemaTest.java @@ -14,10 +14,12 @@ */ package org.geowebcache.config; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.instanceOf; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertThrows; import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.security.ForbiddenClassException; import java.util.Collections; import org.easymock.Capture; import org.easymock.EasyMock; @@ -27,14 +29,11 @@ import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.StaticWebApplicationContext; public class XMLConfigurationXSchemaTest { - @Rule public ExpectedException exception = ExpectedException.none(); - @Rule public PropertyRule whitelistProperty = PropertyRule.system("GEOWEBCACHE_XSTREAM_WHITELIST"); @@ -43,15 +42,15 @@ public void testNotAllowNonGWCClass() throws Exception { // Check that classes from other packages on the class path can't be serialized ContextualConfigurationProvider.Context pc = ContextualConfigurationProvider.Context.REST; try (StaticWebApplicationContext wac = new StaticWebApplicationContext()) { - - XStream xs = new GeoWebCacheXStream(); - - xs = XMLConfiguration.getConfiguredXStreamWithContext(xs, wac, pc); - - exception.expect(com.thoughtworks.xstream.security.ForbiddenClassException.class); - - @SuppressWarnings("unused") - Object o = xs.fromXML("<" + org.easymock.Capture.class.getCanonicalName() + " />"); + XStream xs = + XMLConfiguration.getConfiguredXStreamWithContext( + new GeoWebCacheXStream(), wac, pc); + + assertThrows( + ForbiddenClassException.class, + () -> { + xs.fromXML("<" + org.easymock.Capture.class.getCanonicalName() + " />"); + }); } } @@ -62,15 +61,16 @@ public void testNotAllowNonXMLGWCClass() throws Exception { ContextualConfigurationProvider.Context pc = ContextualConfigurationProvider.Context.REST; try (StaticWebApplicationContext wac = new StaticWebApplicationContext()) { - XStream xs = new GeoWebCacheXStream(); - - xs = XMLConfiguration.getConfiguredXStreamWithContext(xs, wac, pc); - - exception.expect(com.thoughtworks.xstream.security.ForbiddenClassException.class); - - @SuppressWarnings("unused") - Object o = - xs.fromXML("<" + XMLConfigurationXSchemaTest.class.getCanonicalName() + " />"); + XStream xs = + XMLConfiguration.getConfiguredXStreamWithContext( + new GeoWebCacheXStream(), wac, pc); + assertThrows( + ForbiddenClassException.class, + () -> + xs.fromXML( + "<" + + XMLConfigurationXSchemaTest.class.getCanonicalName() + + " />")); } } diff --git a/geowebcache/core/src/test/java/org/geowebcache/config/legends/LegendInfoBuilderTest.java b/geowebcache/core/src/test/java/org/geowebcache/config/legends/LegendInfoBuilderTest.java index 01e49f63a..9b8d58770 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/config/legends/LegendInfoBuilderTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/config/legends/LegendInfoBuilderTest.java @@ -14,9 +14,9 @@ */ package org.geowebcache.config.legends; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertThat; import org.junit.Test; diff --git a/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/FloatParameterFilterTest.java b/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/FloatParameterFilterTest.java index c6e060fe6..625af935a 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/FloatParameterFilterTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/FloatParameterFilterTest.java @@ -14,12 +14,12 @@ */ package org.geowebcache.filter.parameters; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasProperty; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; import com.thoughtworks.xstream.XStream; diff --git a/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/IntegerParameterFilterTest.java b/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/IntegerParameterFilterTest.java index 627ac9673..5d1b5bcb6 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/IntegerParameterFilterTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/IntegerParameterFilterTest.java @@ -14,12 +14,12 @@ */ package org.geowebcache.filter.parameters; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasProperty; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; import com.thoughtworks.xstream.XStream; diff --git a/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/ParametersUtilsTest.java b/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/ParametersUtilsTest.java index a3cfe73b0..c885a8d38 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/ParametersUtilsTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/ParametersUtilsTest.java @@ -14,10 +14,10 @@ */ package org.geowebcache.filter.parameters; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.isEmptyString; -import static org.junit.Assert.assertThat; import java.util.Collections; import java.util.Map; diff --git a/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/RegexParameterFilterTest.java b/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/RegexParameterFilterTest.java index fa68f88da..5bb9665cb 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/RegexParameterFilterTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/RegexParameterFilterTest.java @@ -14,6 +14,7 @@ */ package org.geowebcache.filter.parameters; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasProperty; @@ -21,7 +22,6 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/StringParameterFilterTest.java b/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/StringParameterFilterTest.java index cf4bc98b3..ff32968d4 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/StringParameterFilterTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/filter/parameters/StringParameterFilterTest.java @@ -14,13 +14,13 @@ */ package org.geowebcache.filter.parameters; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasProperty; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; import com.thoughtworks.xstream.XStream; diff --git a/geowebcache/core/src/test/java/org/geowebcache/grid/DefaultGridSetsTest.java b/geowebcache/core/src/test/java/org/geowebcache/grid/DefaultGridSetsTest.java index 862d43b1c..f5e1e9edd 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/grid/DefaultGridSetsTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/grid/DefaultGridSetsTest.java @@ -14,10 +14,10 @@ */ package org.geowebcache.grid; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; import java.util.Arrays; import org.geowebcache.config.DefaultGridsets; diff --git a/geowebcache/core/src/test/java/org/geowebcache/grid/GridSetBrokerTest.java b/geowebcache/core/src/test/java/org/geowebcache/grid/GridSetBrokerTest.java index eda5ebdbd..c58479295 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/grid/GridSetBrokerTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/grid/GridSetBrokerTest.java @@ -16,6 +16,7 @@ import static org.geowebcache.util.TestUtils.isPresent; import static org.geowebcache.util.TestUtils.notPresent; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.hasProperty; @@ -24,7 +25,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/geowebcache/core/src/test/java/org/geowebcache/grid/GridSetTest.java b/geowebcache/core/src/test/java/org/geowebcache/grid/GridSetTest.java index 0f0be92d2..e6d67c1ed 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/grid/GridSetTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/grid/GridSetTest.java @@ -1,10 +1,10 @@ package org.geowebcache.grid; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasProperty; import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertThat; import java.util.Collections; import org.geowebcache.config.DefaultGridsets; diff --git a/geowebcache/core/src/test/java/org/geowebcache/layer/wms/TileLayerTest.java b/geowebcache/core/src/test/java/org/geowebcache/layer/wms/TileLayerTest.java index cb9ef3fac..69572b58c 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/layer/wms/TileLayerTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/layer/wms/TileLayerTest.java @@ -1,11 +1,11 @@ package org.geowebcache.layer.wms; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalToIgnoringCase; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; import java.util.Arrays; import java.util.Collection; diff --git a/geowebcache/core/src/test/java/org/geowebcache/layer/wms/WMSLayerTest.java b/geowebcache/core/src/test/java/org/geowebcache/layer/wms/WMSLayerTest.java index 20d181954..b5b42c9df 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/layer/wms/WMSLayerTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/layer/wms/WMSLayerTest.java @@ -22,10 +22,10 @@ import static org.geowebcache.TestHelpers.createRequest; import static org.geowebcache.TestHelpers.createWMSLayer; import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.awt.Color; diff --git a/geowebcache/core/src/test/java/org/geowebcache/seed/TruncateBboxRequestTest.java b/geowebcache/core/src/test/java/org/geowebcache/seed/TruncateBboxRequestTest.java index 197cfc22e..8fd906c2d 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/seed/TruncateBboxRequestTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/seed/TruncateBboxRequestTest.java @@ -15,12 +15,12 @@ package org.geowebcache.seed; import static org.easymock.EasyMock.eq; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.any; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasProperty; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; import java.util.Arrays; import java.util.Collections; diff --git a/geowebcache/core/src/test/java/org/geowebcache/storage/AbstractBlobStoreTest.java b/geowebcache/core/src/test/java/org/geowebcache/storage/AbstractBlobStoreTest.java index e7f575a9a..7c326ea3a 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/storage/AbstractBlobStoreTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/storage/AbstractBlobStoreTest.java @@ -21,6 +21,7 @@ import static org.easymock.EasyMock.geq; import static org.easymock.EasyMock.isNull; import static org.geowebcache.util.FileMatchers.resource; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.describedAs; import static org.hamcrest.Matchers.empty; @@ -30,7 +31,6 @@ import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertThat; import java.nio.charset.StandardCharsets; import java.util.Arrays; diff --git a/geowebcache/core/src/test/java/org/geowebcache/storage/BlobStoreSuitabilityTest.java b/geowebcache/core/src/test/java/org/geowebcache/storage/BlobStoreSuitabilityTest.java index 673e3173f..f0deefd1d 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/storage/BlobStoreSuitabilityTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/storage/BlobStoreSuitabilityTest.java @@ -14,10 +14,10 @@ */ package org.geowebcache.storage; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.either; import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; import static org.junit.Assume.assumeThat; import org.hamcrest.Matcher; diff --git a/geowebcache/core/src/test/java/org/geowebcache/storage/CompositeBlobStoreTest.java b/geowebcache/core/src/test/java/org/geowebcache/storage/CompositeBlobStoreTest.java index 554eba09a..a1ea0a66a 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/storage/CompositeBlobStoreTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/storage/CompositeBlobStoreTest.java @@ -14,13 +14,13 @@ */ package org.geowebcache.storage; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.argThat; import static org.mockito.Matchers.eq; diff --git a/geowebcache/core/src/test/java/org/geowebcache/storage/TransientCacheTest.java b/geowebcache/core/src/test/java/org/geowebcache/storage/TransientCacheTest.java index e5eac76d7..9a8e86d82 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/storage/TransientCacheTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/storage/TransientCacheTest.java @@ -19,7 +19,7 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import com.google.common.base.Ticker; import java.io.InputStream; diff --git a/geowebcache/core/src/test/java/org/geowebcache/util/FileUtilsTest.java b/geowebcache/core/src/test/java/org/geowebcache/util/FileUtilsTest.java index 225c068a8..fed3ae11e 100644 --- a/geowebcache/core/src/test/java/org/geowebcache/util/FileUtilsTest.java +++ b/geowebcache/core/src/test/java/org/geowebcache/util/FileUtilsTest.java @@ -15,11 +15,11 @@ package org.geowebcache.util; import static org.geowebcache.util.LogTestWrapper.message; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.not; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.io.File; diff --git a/geowebcache/diskquota/bdb/src/test/java/org/geowebcache/diskquota/BDBQuotaStoreTest.java b/geowebcache/diskquota/bdb/src/test/java/org/geowebcache/diskquota/BDBQuotaStoreTest.java index b1803125f..90ef8fa2e 100644 --- a/geowebcache/diskquota/bdb/src/test/java/org/geowebcache/diskquota/BDBQuotaStoreTest.java +++ b/geowebcache/diskquota/bdb/src/test/java/org/geowebcache/diskquota/BDBQuotaStoreTest.java @@ -7,7 +7,7 @@ import static org.hamcrest.Matchers.hasProperty; import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.io.File; import java.math.BigInteger; diff --git a/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/JDBCQuotaStoreTest.java b/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/JDBCQuotaStoreTest.java index b822ce57a..d13b3edf1 100644 --- a/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/JDBCQuotaStoreTest.java +++ b/geowebcache/diskquota/jdbc/src/test/java/org/geowebcache/diskquota/jdbc/JDBCQuotaStoreTest.java @@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/geowebcache/rest/src/test/java/org/geowebcache/rest/service/FormServiceTest.java b/geowebcache/rest/src/test/java/org/geowebcache/rest/service/FormServiceTest.java index 8567714e7..fe6a19549 100644 --- a/geowebcache/rest/src/test/java/org/geowebcache/rest/service/FormServiceTest.java +++ b/geowebcache/rest/src/test/java/org/geowebcache/rest/service/FormServiceTest.java @@ -20,7 +20,7 @@ import static org.easymock.EasyMock.verify; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasProperty; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertTrue; import java.util.Arrays; diff --git a/geowebcache/s3storage/src/test/java/org/geowebcache/s3/OnlineS3BlobStoreIntegrationTest.java b/geowebcache/s3storage/src/test/java/org/geowebcache/s3/OnlineS3BlobStoreIntegrationTest.java index fe2c9961c..ba2c759c3 100644 --- a/geowebcache/s3storage/src/test/java/org/geowebcache/s3/OnlineS3BlobStoreIntegrationTest.java +++ b/geowebcache/s3storage/src/test/java/org/geowebcache/s3/OnlineS3BlobStoreIntegrationTest.java @@ -13,7 +13,7 @@ package org.geowebcache.s3; import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Assume; import org.junit.Rule; diff --git a/geowebcache/s3storage/src/test/java/org/geowebcache/s3/S3BlobStoreConfigSerializeTest.java b/geowebcache/s3storage/src/test/java/org/geowebcache/s3/S3BlobStoreConfigSerializeTest.java index 45285c1c0..ed1244578 100644 --- a/geowebcache/s3storage/src/test/java/org/geowebcache/s3/S3BlobStoreConfigSerializeTest.java +++ b/geowebcache/s3storage/src/test/java/org/geowebcache/s3/S3BlobStoreConfigSerializeTest.java @@ -16,7 +16,7 @@ import static org.hamcrest.Matchers.hasProperty; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import com.amazonaws.services.s3.model.CannedAccessControlList; import com.thoughtworks.xstream.XStream; diff --git a/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/FileManagerTest.java b/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/FileManagerTest.java index 9dd36dafb..22ae0fea5 100644 --- a/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/FileManagerTest.java +++ b/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/FileManagerTest.java @@ -20,7 +20,7 @@ import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.io.File; import java.util.Collections; diff --git a/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/MbtilesBlobStoreTest.java b/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/MbtilesBlobStoreTest.java index 166ba147b..fea6da3c8 100644 --- a/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/MbtilesBlobStoreTest.java +++ b/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/MbtilesBlobStoreTest.java @@ -20,7 +20,7 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.io.File; import java.util.ArrayList; diff --git a/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/MbtilesPBFTest.java b/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/MbtilesPBFTest.java index 7ccf1b13e..2dec4c62a 100644 --- a/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/MbtilesPBFTest.java +++ b/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/MbtilesPBFTest.java @@ -15,7 +15,7 @@ package org.geowebcache.sqlite; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertTrue; import java.io.File; diff --git a/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/OperationsRestTest.java b/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/OperationsRestTest.java index 5fa6eb8c0..8b7a14024 100644 --- a/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/OperationsRestTest.java +++ b/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/OperationsRestTest.java @@ -17,7 +17,7 @@ import static org.geowebcache.sqlite.Utils.Tuple.tuple; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import java.io.File; diff --git a/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/SqliteBlobStoreTest.java b/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/SqliteBlobStoreTest.java index 8c9cc418f..9ea8aa1a7 100644 --- a/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/SqliteBlobStoreTest.java +++ b/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/SqliteBlobStoreTest.java @@ -16,7 +16,7 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.io.File; import java.nio.file.Files; diff --git a/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/SqliteConnectionManagerTest.java b/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/SqliteConnectionManagerTest.java index b373efbbf..421c57785 100644 --- a/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/SqliteConnectionManagerTest.java +++ b/geowebcache/sqlite/src/test/java/org/geowebcache/sqlite/SqliteConnectionManagerTest.java @@ -19,7 +19,7 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.io.File; import java.sql.Connection; diff --git a/geowebcache/swiftblob/src/test/java/org/geowebcache/swift/SwiftBlobStoreTest.java b/geowebcache/swiftblob/src/test/java/org/geowebcache/swift/SwiftBlobStoreTest.java index f581a6f9a..de2c59d6a 100644 --- a/geowebcache/swiftblob/src/test/java/org/geowebcache/swift/SwiftBlobStoreTest.java +++ b/geowebcache/swiftblob/src/test/java/org/geowebcache/swift/SwiftBlobStoreTest.java @@ -19,7 +19,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.any; diff --git a/geowebcache/swiftblob/src/test/java/org/geowebcache/swift/SwiftTileTest.java b/geowebcache/swiftblob/src/test/java/org/geowebcache/swift/SwiftTileTest.java index 39467aca8..484c6c6e7 100644 --- a/geowebcache/swiftblob/src/test/java/org/geowebcache/swift/SwiftTileTest.java +++ b/geowebcache/swiftblob/src/test/java/org/geowebcache/swift/SwiftTileTest.java @@ -15,7 +15,7 @@ package org.geowebcache.swift; import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.Mockito.any; import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.anyLong; diff --git a/geowebcache/web/src/test/java/org/geowebcache/jetty/RestIntegrationTest.java b/geowebcache/web/src/test/java/org/geowebcache/jetty/RestIntegrationTest.java index 98af05553..6f826ba6d 100644 --- a/geowebcache/web/src/test/java/org/geowebcache/jetty/RestIntegrationTest.java +++ b/geowebcache/web/src/test/java/org/geowebcache/jetty/RestIntegrationTest.java @@ -23,7 +23,7 @@ import static org.hamcrest.Matchers.hasProperty; import static org.hamcrest.Matchers.not; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.io.File; import java.io.IOException; diff --git a/geowebcache/wms/src/test/java/org/geowebcache/config/wms/GetCapabilitiesConfigurationTest.java b/geowebcache/wms/src/test/java/org/geowebcache/config/wms/GetCapabilitiesConfigurationTest.java index 640f8fd16..86157d1b5 100644 --- a/geowebcache/wms/src/test/java/org/geowebcache/config/wms/GetCapabilitiesConfigurationTest.java +++ b/geowebcache/wms/src/test/java/org/geowebcache/config/wms/GetCapabilitiesConfigurationTest.java @@ -25,7 +25,7 @@ import static org.hamcrest.beans.HasPropertyWithValue.hasProperty; import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import com.google.common.collect.Sets; import java.net.URL; diff --git a/geowebcache/wms/src/test/java/org/geowebcache/config/wms/GetCapabilitiesGridSetConfigurationConformanceTest.java b/geowebcache/wms/src/test/java/org/geowebcache/config/wms/GetCapabilitiesGridSetConfigurationConformanceTest.java index 0e61c35f7..86d6c1135 100644 --- a/geowebcache/wms/src/test/java/org/geowebcache/config/wms/GetCapabilitiesGridSetConfigurationConformanceTest.java +++ b/geowebcache/wms/src/test/java/org/geowebcache/config/wms/GetCapabilitiesGridSetConfigurationConformanceTest.java @@ -19,7 +19,7 @@ import static org.geowebcache.util.TestUtils.assertPresent; import static org.geowebcache.util.TestUtils.requirePresent; import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import com.google.common.base.Objects; import java.net.URL; diff --git a/geowebcache/wms/src/test/java/org/geowebcache/config/wms/GetCapabilitiesLayerConfigurationConformanceTest.java b/geowebcache/wms/src/test/java/org/geowebcache/config/wms/GetCapabilitiesLayerConfigurationConformanceTest.java index 7c456bf47..7c7c6b04c 100644 --- a/geowebcache/wms/src/test/java/org/geowebcache/config/wms/GetCapabilitiesLayerConfigurationConformanceTest.java +++ b/geowebcache/wms/src/test/java/org/geowebcache/config/wms/GetCapabilitiesLayerConfigurationConformanceTest.java @@ -17,7 +17,7 @@ import static org.easymock.EasyMock.createNiceMock; import static org.easymock.EasyMock.expect; import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.net.URL; import java.util.Collections; diff --git a/geowebcache/wms/src/test/java/org/geowebcache/service/wms/WMSGetCapabilitiesTest.java b/geowebcache/wms/src/test/java/org/geowebcache/service/wms/WMSGetCapabilitiesTest.java index 4472a5d2c..299259d5b 100644 --- a/geowebcache/wms/src/test/java/org/geowebcache/service/wms/WMSGetCapabilitiesTest.java +++ b/geowebcache/wms/src/test/java/org/geowebcache/service/wms/WMSGetCapabilitiesTest.java @@ -5,7 +5,7 @@ import static org.easymock.EasyMock.replay; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import java.io.StringReader; import java.nio.charset.StandardCharsets; diff --git a/geowebcache/wms/src/test/java/org/geowebcache/service/wms/WMSServiceTest.java b/geowebcache/wms/src/test/java/org/geowebcache/service/wms/WMSServiceTest.java index de77de5a3..3566afbbb 100644 --- a/geowebcache/wms/src/test/java/org/geowebcache/service/wms/WMSServiceTest.java +++ b/geowebcache/wms/src/test/java/org/geowebcache/service/wms/WMSServiceTest.java @@ -10,7 +10,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.eq;