diff --git a/core/src/test/java/org/springframework/plugin/core/OrderAwarePluginRegistryUnitTest.java b/core/src/test/java/org/springframework/plugin/core/OrderAwarePluginRegistryUnitTest.java index fe6fc58..9bdafab 100644 --- a/core/src/test/java/org/springframework/plugin/core/OrderAwarePluginRegistryUnitTest.java +++ b/core/src/test/java/org/springframework/plugin/core/OrderAwarePluginRegistryUnitTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2019 the original author or authors. + * Copyright 2008-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,16 +15,14 @@ */ package org.springframework.plugin.core; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; +import static org.assertj.core.api.Assertions.*; import static org.springframework.plugin.core.PluginRegistry.*; import java.util.Collections; import java.util.List; -import java.util.Optional; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.aop.framework.ProxyFactory; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; @@ -35,14 +33,14 @@ import org.springframework.test.util.ReflectionTestUtils; * * @author Oliver Gierke */ -public class OrderAwarePluginRegistryUnitTest extends SimplePluginRegistryUnitTest { +class OrderAwarePluginRegistryUnitTest extends SimplePluginRegistryUnitTest { TestPlugin firstPlugin; TestPlugin secondPlugin; @Override - @Before - public void setUp() { + @BeforeEach + void setUp() { super.setUp(); @@ -51,14 +49,14 @@ public class OrderAwarePluginRegistryUnitTest extends SimplePluginRegistryUnitTe } @Test - public void honorsOrderOnAddPlugins() throws Exception { + void honorsOrderOnAddPlugins() throws Exception { PluginRegistry registry = of(firstPlugin, secondPlugin); assertOrder(registry, secondPlugin, firstPlugin); } @Test - public void createsRevertedRegistryCorrectly() throws Exception { + void createsRevertedRegistryCorrectly() throws Exception { OrderAwarePluginRegistry registry = OrderAwarePluginRegistry.of(firstPlugin, secondPlugin); PluginRegistry reverse = registry.reverse(); @@ -71,7 +69,7 @@ public class OrderAwarePluginRegistryUnitTest extends SimplePluginRegistryUnitTe * @see #1 */ @Test - public void considersJdkProxiedOrderedImplementation() { + void considersJdkProxiedOrderedImplementation() { ThirdImplementation plugin = new ThirdImplementation(); TestPlugin thirdPlugin = (TestPlugin) new ProxyFactory(plugin).getProxy(); @@ -84,37 +82,37 @@ public class OrderAwarePluginRegistryUnitTest extends SimplePluginRegistryUnitTe } @Test - public void defaultSetupUsesDefaultComparator() { + void defaultSetupUsesDefaultComparator() { assertDefaultComparator(OrderAwarePluginRegistry.empty()); } @Test - public void defaultSetupUsesDefaultReverseComparator() { + void defaultSetupUsesDefaultReverseComparator() { OrderAwarePluginRegistry, Object> registry = OrderAwarePluginRegistry .ofReverse(Collections.emptyList()); Object field = ReflectionTestUtils.getField(registry, "comparator"); - assertThat(field, is(ReflectionTestUtils.getField(registry, "DEFAULT_REVERSE_COMPARATOR"))); + assertThat(field).isEqualTo(ReflectionTestUtils.getField(registry, "DEFAULT_REVERSE_COMPARATOR")); } private static void assertOrder(PluginRegistry registry, TestPlugin... plugins) { List result = registry.getPluginsFor("delimiter"); - assertThat(plugins.length, is(result.size())); + assertThat(plugins.length).isEqualTo(result.size()); for (int i = 0; i < plugins.length; i++) { - assertThat(result.get(i), is(plugins[i])); + assertThat(result.get(i)).isEqualTo(plugins[i]); } - assertThat(registry.getPluginFor("delimiter"), is(Optional.of(plugins[0]))); + assertThat(registry.getPluginFor("delimiter")).hasValue(plugins[0]); } private static void assertDefaultComparator(OrderAwarePluginRegistry registry) { Object field = ReflectionTestUtils.getField(registry, "comparator"); - assertThat(field, is(ReflectionTestUtils.getField(registry, "DEFAULT_COMPARATOR"))); + assertThat(field).isEqualTo(ReflectionTestUtils.getField(registry, "DEFAULT_COMPARATOR")); } private static interface TestPlugin extends Plugin { diff --git a/core/src/test/java/org/springframework/plugin/core/SamplePlugin.java b/core/src/test/java/org/springframework/plugin/core/SamplePlugin.java index 74534e0..3deacef 100644 --- a/core/src/test/java/org/springframework/plugin/core/SamplePlugin.java +++ b/core/src/test/java/org/springframework/plugin/core/SamplePlugin.java @@ -15,12 +15,9 @@ */ package org.springframework.plugin.core; -import org.springframework.plugin.core.Plugin; - /** * @author Oliver Gierke */ public interface SamplePlugin extends Plugin { - void pluginMethod(); } diff --git a/core/src/test/java/org/springframework/plugin/core/SimplePluginRegistryUnitTest.java b/core/src/test/java/org/springframework/plugin/core/SimplePluginRegistryUnitTest.java index 30cad78..c720e00 100644 --- a/core/src/test/java/org/springframework/plugin/core/SimplePluginRegistryUnitTest.java +++ b/core/src/test/java/org/springframework/plugin/core/SimplePluginRegistryUnitTest.java @@ -15,37 +15,32 @@ */ package org.springframework.plugin.core; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; +import static org.assertj.core.api.Assertions.*; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Unit test for {@link SimplePluginRegistry}. * * @author Oliver Gierke */ -public class SimplePluginRegistryUnitTest { +class SimplePluginRegistryUnitTest { SamplePlugin plugin; SimplePluginRegistry registry; - public @Rule ExpectedException o_O = ExpectedException.none(); - /** * Initializes a {@code PluginRegistry} and equips it with an {@code EmailNotificationProvider}. */ - @Before - public void setUp() { + @BeforeEach + void setUp() { plugin = new SamplePluginImplementation(); registry = SimplePluginRegistry.empty(); @@ -57,117 +52,111 @@ public class SimplePluginRegistryUnitTest { * @throws Exception */ @Test - public void assertRegistryInitialized() throws Exception { + void assertRegistryInitialized() throws Exception { registry = SimplePluginRegistry.of(plugin); - assertThat(registry.countPlugins(), is(1)); - assertTrue(registry.contains(plugin)); + assertThat(registry.countPlugins()).isEqualTo(1); + assertThat(registry.contains(plugin)).isTrue(); } /** * Asserts asking for a plugin with the {@code PluginMetadata} provided by the {@link EmailNotificationProvider}. */ @Test - public void assertFindsEmailNotificationProvider() { + void assertFindsEmailNotificationProvider() { registry = SimplePluginRegistry.of(plugin); String delimiter = "FOO"; List plugins = registry.getPluginsFor(delimiter); - assertThat(plugins, is(notNullValue())); - assertThat(plugins.size(), is(1)); + assertThat(plugins).isNotNull(); + assertThat(plugins).hasSize(1); SamplePlugin provider = plugins.get(0); - assertThat(provider, is(instanceOf(SamplePluginImplementation.class))); + assertThat(provider).isInstanceOf(SamplePluginImplementation.class); } /** * Expects the given exception to be thrown if no {@link Plugin} found. */ - @Test(expected = IllegalArgumentException.class) - public void throwsExceptionIfNoPluginFound() { + @Test + void throwsExceptionIfNoPluginFound() { - registry.getPluginFor("BAR", () -> new IllegalArgumentException()); + assertThatIllegalArgumentException() + .isThrownBy(() -> registry.getPluginFor("BAR", () -> new IllegalArgumentException())); } /** * Expects the given exception to be thrown if no {@link Plugin}s found. */ - @Test(expected = IllegalArgumentException.class) - public void throwsExceptionIfNoPluginsFound() { + @Test + void throwsExceptionIfNoPluginsFound() { - registry.getPluginsFor("BAR", () -> new IllegalArgumentException()); + assertThatIllegalArgumentException() + .isThrownBy(() -> registry.getPluginsFor("BAR", () -> new IllegalArgumentException())); } /** * Expect the defualt plugin to be returned if none found. */ @Test - public void returnsDefaultIfNoneFound() { + void returnsDefaultIfNoneFound() { SamplePlugin defaultPlugin = new SamplePluginImplementation(); - assertThat(registry.getPluginOrDefaultFor("BAR", defaultPlugin), is(defaultPlugin)); + assertThat(registry.getPluginOrDefaultFor("BAR", defaultPlugin)).isEqualTo(defaultPlugin); } /** * Expect the given default plugins to be returned if none found. */ @Test - public void returnsDefaultsIfNoneFound() { + void returnsDefaultsIfNoneFound() { List defaultPlugins = Arrays.asList(new SamplePluginImplementation()); List result = registry.getPluginsFor("BAR", defaultPlugins); - assertTrue(result.containsAll(defaultPlugins)); + assertThat(result).containsAll(defaultPlugins); } @Test - public void handlesAddingNullPluginsCorrecty() throws Exception { + void handlesAddingNullPluginsCorrecty() throws Exception { List plugins = new ArrayList(); plugins.add(null); registry = SimplePluginRegistry.of(plugins); - assertThat(registry.countPlugins(), is(0)); + assertThat(registry.countPlugins()).isEqualTo(0); } - /** - * @see #19 - */ - @Test(expected = IllegalStateException.class) - public void throwsExceptionFromSupplier() throws Exception { + @Test // #19 + void throwsExceptionFromSupplier() throws Exception { registry = SimplePluginRegistry.empty(); - registry.getPluginFor("FOO", () -> new IllegalStateException()); + assertThatIllegalStateException() + .isThrownBy(() -> registry.getPluginFor("FOO", () -> new IllegalStateException())); } - /** - * @see #41 - */ - public void throwsExceptionIfRequiredPluginIsNotFound() { + @Test // #41 + void throwsExceptionIfRequiredPluginIsNotFound() { registry = SimplePluginRegistry.empty(); - o_O.expect(IllegalArgumentException.class); - - registry.getRequiredPluginFor("FOO"); + assertThatIllegalArgumentException() + .isThrownBy(() -> registry.getRequiredPluginFor("FOO")); } - /** - * @see #41 - */ - public void throwsExceptionWithMessafeIfRequiredPluginIsNotFound() { + @Test // #41 + void throwsExceptionWithMessafeIfRequiredPluginIsNotFound() { registry = SimplePluginRegistry.of(Collections.emptyList()); - o_O.expect(IllegalArgumentException.class); - o_O.expectMessage("message"); - - registry.getRequiredPluginFor("FOO", () -> "message"); + assertThatIllegalArgumentException() + .isThrownBy(() -> registry.getRequiredPluginFor("FOO", () -> "message")) + .withMessage("message"); } } diff --git a/core/src/test/java/org/springframework/plugin/core/config/EnablePluginRegistriesIntegrationTest.java b/core/src/test/java/org/springframework/plugin/core/config/EnablePluginRegistriesIntegrationTest.java index 6a9afe3..618db38 100644 --- a/core/src/test/java/org/springframework/plugin/core/config/EnablePluginRegistriesIntegrationTest.java +++ b/core/src/test/java/org/springframework/plugin/core/config/EnablePluginRegistriesIntegrationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,10 @@ */ package org.springframework.plugin.core.config; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; +import static org.assertj.core.api.Assertions.*; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; @@ -29,16 +28,16 @@ import org.springframework.plugin.core.PluginRegistry; import org.springframework.plugin.core.SamplePlugin; import org.springframework.plugin.core.SamplePluginImplementation; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; /** * Integration tests for {@link EnablePluginRegistries}. - * + * * @author Oliver Gierke */ -@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration -public class EnablePluginRegistriesIntegrationTest { +@ExtendWith(SpringExtension.class) +class EnablePluginRegistriesIntegrationTest { @Configuration @EnablePluginRegistries({ SamplePlugin.class, AnotherPlugin.class }) @@ -53,8 +52,8 @@ public class EnablePluginRegistriesIntegrationTest { @Autowired PluginRegistry registry; @Test - public void registersPluginRegistries() { - assertThat(registry, is(notNullValue())); + void registersPluginRegistries() { + assertThat(registry).isNotNull(); } @Qualifier("myQualifier") diff --git a/core/src/test/java/org/springframework/plugin/core/config/PluginConfigurationIntegrationTest.java b/core/src/test/java/org/springframework/plugin/core/config/PluginConfigurationIntegrationTest.java index 4a00128..513b291 100644 --- a/core/src/test/java/org/springframework/plugin/core/config/PluginConfigurationIntegrationTest.java +++ b/core/src/test/java/org/springframework/plugin/core/config/PluginConfigurationIntegrationTest.java @@ -15,56 +15,48 @@ */ package org.springframework.plugin.core.config; -import static org.junit.Assert.*; +import static org.assertj.core.api.Assertions.*; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.plugin.core.PluginRegistry; import org.springframework.plugin.core.SamplePlugin; import org.springframework.plugin.core.SamplePluginHost; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; /** * Integration test to simply check if the configuration gets parsed correctly. - * + * * @author Oliver Gierke */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration(locations = "classpath:application-context.xml") -public class PluginConfigurationIntegrationTest { +class PluginConfigurationIntegrationTest { - @Autowired - List samplePlugins; + @Autowired List samplePlugins; - @Autowired - @Qualifier("bar") - PluginRegistry pluginRegistry; + @Autowired @Qualifier("bar") PluginRegistry pluginRegistry; - @Autowired - @Qualifier("host") - SamplePluginHost host; + @Autowired @Qualifier("host") SamplePluginHost host; - @Autowired - @Qualifier("otherHost") - SamplePluginHost otherHost; + @Autowired @Qualifier("otherHost") SamplePluginHost otherHost; - @Autowired - SamplePlugin plugin; + @Autowired SamplePlugin plugin; @Test - public void test() throws Exception { + void test() throws Exception { - assertNotNull(samplePlugins); + assertThat(samplePlugins).isNotNull(); - assertSame(pluginRegistry, host.getRegistry()); - assertNotSame(pluginRegistry, otherHost.getRegistry()); + assertThat(pluginRegistry).isSameAs(host.getRegistry()); + assertThat(pluginRegistry).isNotSameAs(otherHost.getRegistry()); - assertTrue(samplePlugins.contains(plugin)); - assertTrue(pluginRegistry.contains(plugin)); + assertThat(samplePlugins).contains(plugin); + assertThat(pluginRegistry).contains(plugin); } } diff --git a/core/src/test/java/org/springframework/plugin/core/support/BeanListFactoryBeanUnitTest.java b/core/src/test/java/org/springframework/plugin/core/support/BeanListFactoryBeanUnitTest.java index c16210e..578aa22 100644 --- a/core/src/test/java/org/springframework/plugin/core/support/BeanListFactoryBeanUnitTest.java +++ b/core/src/test/java/org/springframework/plugin/core/support/BeanListFactoryBeanUnitTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2012 the original author or authors. + * Copyright 2008-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,34 +15,34 @@ */ package org.springframework.plugin.core.support; -import static org.junit.Assert.*; -import static org.mockito.Matchers.*; +import static org.assertj.core.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; import java.util.List; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.context.ApplicationContext; import org.springframework.core.Ordered; /** * Unit test for {@link BeanListFactoryBean}. - * + * * @author Oliver Gierke */ -@RunWith(MockitoJUnitRunner.class) -public class BeanListFactoryBeanUnitTest { +@ExtendWith(MockitoExtension.class) +class BeanListFactoryBeanUnitTest { BeanListFactoryBean factory; @Mock ApplicationContext context; - @Before - public void setUp() { + @BeforeEach + void setUp() { factory = new BeanListFactoryBean(); factory.setApplicationContext(context); @@ -52,7 +52,7 @@ public class BeanListFactoryBeanUnitTest { @Test @SuppressWarnings({ "rawtypes", "unchecked" }) - public void regardsOrderOfBeans() throws Exception { + void regardsOrderOfBeans() throws Exception { // They shall be switched in the result. Ordered first = () -> 5; @@ -64,28 +64,20 @@ public class BeanListFactoryBeanUnitTest { when(context.getBean("second")).thenReturn(second); Object result = factory.getObject(); - assertTrue(result instanceof List); + assertThat(result).isInstanceOfSatisfying(List.class, it -> { - List members = type(result); - - assertEquals(0, members.indexOf(second)); - assertEquals(1, members.indexOf(first)); + assertThat(it.indexOf(second)).isEqualByComparingTo(0); + assertThat(it.indexOf(first)).isEqualTo(1); + }); } @Test + @SuppressWarnings("unchecked") public void returnsEmptyListIfNoBeansFound() throws Exception { when(context.getBeanNamesForType(Ordered.class, false, false)).thenReturn(new String[0]); Object result = factory.getObject(); - assertTrue(result instanceof List); - - List members = type(result); - assertTrue(members.isEmpty()); - } - - @SuppressWarnings("unchecked") - private List type(Object list) { - return (List) list; + assertThat(result).isInstanceOfSatisfying(List.class, it -> assertThat(it).isEmpty()); } } diff --git a/core/src/test/java/org/springframework/plugin/core/support/OrderAwarePluginRegistryIntegrationTest.java b/core/src/test/java/org/springframework/plugin/core/support/OrderAwarePluginRegistryIntegrationTest.java index 711cf05..e7ff272 100644 --- a/core/src/test/java/org/springframework/plugin/core/support/OrderAwarePluginRegistryIntegrationTest.java +++ b/core/src/test/java/org/springframework/plugin/core/support/OrderAwarePluginRegistryIntegrationTest.java @@ -1,13 +1,11 @@ package org.springframework.plugin.core.support; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; +import static org.assertj.core.api.Assertions.*; import java.util.List; -import org.hamcrest.Matchers; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; @@ -18,16 +16,16 @@ import org.springframework.plugin.core.OrderAwarePluginRegistry; import org.springframework.plugin.core.Plugin; import org.springframework.plugin.core.config.EnablePluginRegistries; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; /** * Integration test for {@link OrderAwarePluginRegistry}. - * + * * @author Oliver Gierke */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @ContextConfiguration -public class OrderAwarePluginRegistryIntegrationTest { +class OrderAwarePluginRegistryIntegrationTest { @Configuration @EnablePluginRegistries(TestPlugin.class) @@ -49,34 +47,29 @@ public class OrderAwarePluginRegistryIntegrationTest { } } - @Autowired - ApplicationContext context; + @Autowired ApplicationContext context; - @Autowired - FirstImplementation first; - @Autowired - SecondImplementation second; - @Autowired - ThirdImplementation third; + @Autowired FirstImplementation first; + @Autowired SecondImplementation second; + @Autowired ThirdImplementation third; - @Autowired - OrderAwarePluginRegistry registry; + @Autowired OrderAwarePluginRegistry registry; @Test - public void considersJdkProxiedOrderedImplementation() { + void considersJdkProxiedOrderedImplementation() { List plugins = registry.getPlugins(); - assertThat(plugins, Matchers.hasSize(3)); - assertThat(plugins.get(0), is((TestPlugin) second)); - assertThat(plugins.get(1), is((TestPlugin) third)); - assertThat(plugins.get(2), is((TestPlugin) first)); + assertThat(plugins).hasSize(3); + assertThat(plugins.get(0)).isEqualTo(second); + assertThat(plugins.get(1)).isEqualTo(third); + assertThat(plugins.get(2)).isEqualTo(first); plugins = registry.reverse().getPlugins(); - assertThat(plugins.get(2), is((TestPlugin) second)); - assertThat(plugins.get(1), is((TestPlugin) third)); - assertThat(plugins.get(0), is((TestPlugin) first)); + assertThat(plugins.get(2)).isEqualTo(second); + assertThat(plugins.get(1)).isEqualTo(third); + assertThat(plugins.get(0)).isEqualTo(first); } private static interface TestPlugin extends Plugin { diff --git a/metadata/src/test/java/org/springframework/plugin/metadata/SimplePluginMetadataUnitTest.java b/metadata/src/test/java/org/springframework/plugin/metadata/SimplePluginMetadataUnitTest.java index 8359cc1..e41a99b 100644 --- a/metadata/src/test/java/org/springframework/plugin/metadata/SimplePluginMetadataUnitTest.java +++ b/metadata/src/test/java/org/springframework/plugin/metadata/SimplePluginMetadataUnitTest.java @@ -1,12 +1,12 @@ /* - * Copyright 2015 the original author or authors. - * + * Copyright 2015-2021 the original author or authors. + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * https://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -15,37 +15,36 @@ */ package org.springframework.plugin.metadata; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; +import static org.assertj.core.api.Assertions.*; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * Unit tests for {@link SimplePluginMetadata}. - * + * * @author Oliver Gierke */ -public class SimplePluginMetadataUnitTest { +class SimplePluginMetadataUnitTest { /** * @see #11 */ @Test - public void equalsIsWorkingCorrectly() { + void equalsIsWorkingCorrectly() { SimplePluginMetadata nameOneOh = new SimplePluginMetadata("Name", "1.0"); SimplePluginMetadata sameNameOneOh = new SimplePluginMetadata("Name", "1.0"); SimplePluginMetadata nameTwoOh = new SimplePluginMetadata("Name", "2.0"); SimplePluginMetadata anotherNameOneOh = new SimplePluginMetadata("AnotherName", "1.0"); - assertThat(nameOneOh, is(nameOneOh)); - assertThat(nameOneOh, is(sameNameOneOh)); - assertThat(sameNameOneOh, is(nameOneOh)); + assertThat(nameOneOh).isEqualTo(nameOneOh); + assertThat(nameOneOh).isEqualTo(sameNameOneOh); + assertThat(sameNameOneOh).isEqualTo(nameOneOh); - assertThat(nameOneOh, is(not(nameTwoOh))); - assertThat(nameTwoOh, is(not(nameOneOh))); + assertThat(nameOneOh).isNotEqualTo(nameTwoOh); + assertThat(nameTwoOh).isNotEqualTo(nameOneOh); - assertThat(nameOneOh, is(not(anotherNameOneOh))); - assertThat(anotherNameOneOh, is(not(nameOneOh))); + assertThat(nameOneOh).isNotEqualTo(anotherNameOneOh); + assertThat(anotherNameOneOh).isNotEqualTo(nameOneOh); } } diff --git a/pom.xml b/pom.xml index c484e28..23fbdb8 100644 --- a/pom.xml +++ b/pom.xml @@ -45,8 +45,13 @@ UTF-8 + + 3.20.2 + 5.8.0 + 3.12.4 5.2.0.RELEASE 1.7.25 + spring.plugin @@ -240,16 +245,30 @@ - junit - junit - 4.12 + org.junit.jupiter + junit-jupiter + 5.8.0 + test + + + + org.assertj + assertj-core + ${assertj.version} test org.mockito - mockito-all - 1.10.19 + mockito-core + ${mockito.version} + test + + + + org.mockito + mockito-junit-jupiter + ${mockito.version} test @@ -288,6 +307,12 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + org.apache.maven.plugins maven-source-plugin