diff --git a/bom/pom.xml b/bom/pom.xml index af1ca47083..291a6d22b7 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -105,7 +105,7 @@ commons-io commons-io - 2.7 + 2.15.1 commons-codec diff --git a/tests/tests-core/src/main/java/com/gentics/mesh/cli/MeshNameProviderTest.java b/tests/tests-core/src/main/java/com/gentics/mesh/cli/MeshNameProviderTest.java index 9bc5f6f42d..c306d3d419 100644 --- a/tests/tests-core/src/main/java/com/gentics/mesh/cli/MeshNameProviderTest.java +++ b/tests/tests-core/src/main/java/com/gentics/mesh/cli/MeshNameProviderTest.java @@ -4,14 +4,9 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.time.LocalDate; -import java.util.Date; import org.apache.commons.lang3.StringUtils; -import org.joda.time.DateTimeUtils; -import org.junit.After; import org.junit.Test; import org.mockito.Mockito; @@ -43,17 +38,12 @@ public void testFirstApril() throws Exception { } @Test - public void testNonApril() throws ParseException { - SimpleDateFormat sdf = new SimpleDateFormat("MM-dd"); - Date secondApril = sdf.parse("02-01"); - // always return the same time when querying current time - DateTimeUtils.setCurrentMillisFixed(secondApril.getTime()); - String name = MeshNameProvider.getInstance().getRandomName(); - assertFalse("We did not expect a skynet name but we got one {" + name + "}", name.indexOf("Skynet") > 0); - } + public void testNonApril() throws Exception { + LocalDate inputDate = LocalDate.of(2017, 4, 2); - @After - public void cleanUp() { - DateTimeUtils.setCurrentMillisSystem(); + MeshNameProvider spy = Mockito.spy(new MeshNameProvider()); + Mockito.when(spy.getDate()).thenReturn(inputDate); + String name = spy.getRandomName(); + assertFalse("We did not expect a skynet name but we got one {" + name + "}", name.indexOf("Skynet") > 0); } } diff --git a/tests/tests-core/src/main/java/com/gentics/mesh/core/field/binary/BinaryFieldExtractOptionTest.java b/tests/tests-core/src/main/java/com/gentics/mesh/core/field/binary/BinaryFieldExtractOptionTest.java index 3e98b8d371..fcd0e81983 100644 --- a/tests/tests-core/src/main/java/com/gentics/mesh/core/field/binary/BinaryFieldExtractOptionTest.java +++ b/tests/tests-core/src/main/java/com/gentics/mesh/core/field/binary/BinaryFieldExtractOptionTest.java @@ -77,10 +77,10 @@ public void testDefault() throws Exception { // Same as both setUp(null); - assertThat(metadata.get("subject")).isEqualTo("TestSubject"); - assertThat(metadata.getMap()).hasSize(49); + assertThat(metadata.get("dc_subject")).isEqualTo("TestSubject"); + assertThat(metadata.getMap()).hasSize(24); assertThat(plainText).isEqualTo("Das ist ein Word Dokument für den Johannes"); - assertThat(document.getJsonObject("fields").getJsonObject("binary").getJsonObject("metadata").getString("subject")).isEqualTo("TestSubject"); + assertThat(document.getJsonObject("fields").getJsonObject("binary").getJsonObject("metadata").getString("dc_subject")).isEqualTo("TestSubject"); assertThat(document.getJsonObject("fields").getJsonObject("binary").getJsonObject("file").getString("content")).isEqualTo("Das ist ein Word Dokument für den Johannes"); } @@ -104,10 +104,10 @@ public void testMetadata() throws Exception { .setContent(false) ); - assertThat(metadata.get("subject")).isEqualTo("TestSubject"); - assertThat(metadata.getMap()).hasSize(49); + assertThat(metadata.get("dc_subject")).isEqualTo("TestSubject"); + assertThat(metadata.getMap()).hasSize(24); assertThat(plainText).isNull(); - assertThat(document.getJsonObject("fields").getJsonObject("binary").getJsonObject("metadata").getString("subject")).isEqualTo("TestSubject"); + assertThat(document.getJsonObject("fields").getJsonObject("binary").getJsonObject("metadata").getString("dc_subject")).isEqualTo("TestSubject"); assertThat(document.getJsonObject("fields").getJsonObject("binary").getJsonObject("file")).isNull(); } @@ -131,10 +131,10 @@ public void testBoth() throws Exception { .setContent(true) ); - assertThat(metadata.get("subject")).isEqualTo("TestSubject"); - assertThat(metadata.getMap()).hasSize(49); + assertThat(metadata.get("dc_subject")).isEqualTo("TestSubject"); + assertThat(metadata.getMap()).hasSize(24); assertThat(plainText).isEqualTo("Das ist ein Word Dokument für den Johannes"); - assertThat(document.getJsonObject("fields").getJsonObject("binary").getJsonObject("metadata").getString("subject")).isEqualTo("TestSubject"); + assertThat(document.getJsonObject("fields").getJsonObject("binary").getJsonObject("metadata").getString("dc_subject")).isEqualTo("TestSubject"); assertThat(document.getJsonObject("fields").getJsonObject("binary").getJsonObject("file").getString("content")).isEqualTo("Das ist ein Word Dokument für den Johannes"); } @@ -143,14 +143,14 @@ public void testWhitelist() throws Exception { setUp(new BinaryExtractOptions() .setMetadata(true) .setContent(false) - , CollectionUtil.setOf("subject")); + , CollectionUtil.setOf("dc_subject")); - assertThat(metadata.get("subject")).isEqualTo("TestSubject"); + assertThat(metadata.get("dc_subject")).isEqualTo("TestSubject"); assertThat(plainText).isNull(); assertThat(metadata.getLocation()).isNull(); assertThat(metadata.getMap()).hasSize(1); - assertThat(document.getJsonObject("fields").getJsonObject("binary").getJsonObject("metadata").getString("subject")).isEqualTo("TestSubject"); + assertThat(document.getJsonObject("fields").getJsonObject("binary").getJsonObject("metadata").getString("dc_subject")).isEqualTo("TestSubject"); assertThat(document.getJsonObject("fields").getJsonObject("binary").getJsonObject("file")).isNull(); } }