BAEL-1712 Fix tests in libraries project (#4630)

* BAEL-1712 Fix tests in libraries project

-Renamed 45 test files to standard naming conventions.
-Updated maven dependencies in libraries/pom.xml
-Fixed assertion errors in some tests.
-Included libraries project back into parent pom.xml

* BAEL-1712 Fix tests in libraries project

-Downgraded apache maven pmd plugin from 3.9.0 to 3.8 because pmd 6.0.1 present in pmd plugin 3.9.0 was unable to resolve classes having static final inner classes and was resulting into build failure.

* BAEL-1712 Fix libraries

-Fixed JodaTimeUnitTest
This commit is contained in:
Dhawal Kapil 2018-07-06 21:03:23 +05:30 committed by Grzegorz Piwowarek
parent f086ae7814
commit 11edaaf4bc
54 changed files with 76 additions and 70 deletions

View File

@ -206,6 +206,12 @@
<artifactId>serenity-core</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
@ -877,7 +883,7 @@
<googleclient.version>1.23.0</googleclient.version>
<crdt.version>0.1.0</crdt.version>
<multiverse.version>0.7.0</multiverse.version>
<cglib.version>3.2.4</cglib.version>
<cglib.version>3.2.7</cglib.version>
<commons-lang.version>3.6</commons-lang.version>
<commons-text.version>1.1</commons-text.version>
<commons-beanutils.version>1.9.3</commons-beanutils.version>
@ -901,10 +907,10 @@
<flink.version>1.2.0</flink.version>
<jackson.version>2.8.5</jackson.version>
<neuroph.version>2.92</neuroph.version>
<serenity.version>1.4.0</serenity.version>
<serenity.jbehave.version>1.24.0</serenity.jbehave.version>
<serenity.jira.version>1.1.3-rc.5</serenity.jira.version>
<serenity.plugin.version>1.4.0</serenity.plugin.version>
<serenity.version>1.9.26</serenity.version>
<serenity.jbehave.version>1.41.0</serenity.jbehave.version>
<serenity.jira.version>1.9.0</serenity.jira.version>
<serenity.plugin.version>1.9.27</serenity.plugin.version>
<jUnitParams.version>1.1.0</jUnitParams.version>
<netty.version>4.1.20.Final</netty.version>
<commons.collections.version>4.1</commons.collections.version>
@ -921,15 +927,14 @@
<streamex.version>0.6.5</streamex.version>
<vavr.version>0.9.0</vavr.version>
<geotools.version>15.2</geotools.version>
<joda-time.version>2.9.9</joda-time.version>
<hirondelle-date4j.version>1.5.1</hirondelle-date4j.version>
<retrofit.version>2.3.0</retrofit.version>
<joda-time.version>2.9.9</joda-time.version>
<joda-time.version>2.10</joda-time.version>
<hirondelle-date4j.version>1.5.1</hirondelle-date4j.version>
<protonpack.version>1.14</protonpack.version>
<protonpack.version>1.15</protonpack.version>
<unit-ri.version>1.0.3</unit-ri.version>
<cache.version>1.0.0</cache.version>
<hazelcast.version>3.8.4</hazelcast.version>
<hazelcast.version>3.10.2</hazelcast.version>
<caffeine.version>2.5.5</caffeine.version>
<google-api.version>1.23.0</google-api.version>
<google-sheets.version>v4-rev493-1.21.0</google-sheets.version>

View File

@ -10,7 +10,7 @@ import java.util.function.Function;
import static org.junit.Assert.*;
import static io.atlassian.fugue.Unit.Unit;
public class FugueTest {
public class FugueUnitTest {
@Test
public void whenSome_thenDefined() {

View File

@ -7,7 +7,7 @@ import org.apache.commons.collections4.queue.CircularFifoQueue;
import org.junit.Assert;
import org.junit.Test;
public class CircularFifoQueueTest {
public class CircularFifoQueueUnitTest {
private static final int DEFAULT_SIZE = 32;

View File

@ -8,7 +8,7 @@ import org.junit.Test;
import static com.baeldung.commons.chain.AtmConstants.*;
public class AtmChainTest {
public class AtmChainUnitTest {
public static final int EXPECTED_TOTAL_AMOUNT_TO_BE_WITHDRAWN = 460;
public static final int EXPECTED_AMOUNT_LEFT_TO_BE_WITHDRAWN = 0;

View File

@ -18,7 +18,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class CollectionUtilsGuideTest {
public class CollectionUtilsGuideUnitTest {
Customer customer1 = new Customer(1, "Daniel", 123456l, "locality1", "city1", "1234");
Customer customer4 = new Customer(4, "Bob", 456789l, "locality4", "city4", "4567");

View File

@ -17,7 +17,7 @@ import static org.hamcrest.collection.IsMapWithSize.anEmptyMap;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
public class MapUtilsTest {
public class MapUtilsUnitTest {
private String[][] color2DArray = new String[][] { { "RED", "#FF0000" }, { "GREEN", "#00FF00" }, { "BLUE", "#0000FF" } };
private String[] color1DArray = new String[] { "RED", "#FF0000", "GREEN", "#00FF00", "BLUE", "#0000FF" };

View File

@ -14,7 +14,7 @@ import static org.hamcrest.Matchers.not;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
public class BagTests {
public class BagUnitTest {
@Test
public void givenMultipleCopies_whenAdded_theCountIsKept() {

View File

@ -15,7 +15,7 @@ import java.util.Map;
import static org.junit.Assert.assertEquals;
public class CSVReaderWriterTest {
public class CSVReaderWriterUnitTest {
public static final Map<String, String> AUTHOR_BOOK_MAP = Collections.unmodifiableMap(new LinkedHashMap<String, String>() {
{

View File

@ -32,7 +32,7 @@ import org.apache.commons.lang3.time.FastDateFormat;
import org.junit.Assert;
import org.junit.Test;
public class Lang3UtilsTest {
public class Lang3UtilsUnitTest {
@Test
public void test_to_Boolean_fromString() {

View File

@ -6,7 +6,7 @@ import org.apache.commons.math3.analysis.integration.UnivariateIntegrator;
import org.junit.Assert;
import org.junit.Test;
public class IntegrationTest {
public class SimpsonIntegratorUnitTest {
@Test
public void whenUnivariateIntegratorIntegrate_thenCorrect() {

View File

@ -9,7 +9,7 @@ import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class CRDTTest {
public class CRDTUnitTest {
@Test
public void givenGrowOnlySet_whenTwoReplicasDiverge_thenShouldMergeItWithoutAConflict() {

View File

@ -8,7 +8,7 @@ import org.eclipse.collections.impl.list.mutable.FastList;
import org.junit.Before;
import org.junit.Test;
public class AllSatisfyPatternTest {
public class AllSatisfyPatternUnitTest {
MutableList<Integer> list;

View File

@ -8,7 +8,7 @@ import org.eclipse.collections.impl.list.mutable.FastList;
import org.junit.Before;
import org.junit.Test;
public class AnySatisfyPatternTest {
public class AnySatisfyPatternUnitTest {
MutableList<Integer> list;

View File

@ -6,7 +6,7 @@ import org.eclipse.collections.impl.list.mutable.FastList;
import org.assertj.core.api.Assertions;
import org.junit.Test;
public class CollectPatternTest {
public class CollectPatternUnitTest {
@Test
public void whenCollect_thenCorrect() {

View File

@ -5,7 +5,7 @@ import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.impl.list.mutable.FastList;
import org.junit.Test;
public class ConvertContainerToAnotherTest {
public class ConvertContainerToAnotherUnitTest {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test

View File

@ -7,7 +7,7 @@ import org.eclipse.collections.impl.list.mutable.FastList;
import org.junit.Before;
import org.junit.Test;
public class DetectPatternTest {
public class DetectPatternUnitTest {
MutableList<Integer> list;

View File

@ -10,7 +10,7 @@ import java.util.List;
import org.junit.Before;
import org.junit.Test;
public class FlatCollectTest {
public class FlatCollectUnitTest {
MutableList<String> addresses1;
MutableList<String> addresses2;

View File

@ -7,7 +7,7 @@ import org.eclipse.collections.impl.map.mutable.UnifiedMap;
import org.eclipse.collections.impl.tuple.Tuples;
import org.junit.Test;
public class ForEachPatternTest {
public class ForEachPatternUnitTest {
@SuppressWarnings("unchecked")
@Test

View File

@ -7,7 +7,7 @@ import java.util.List;
import org.eclipse.collections.impl.factory.Lists;
import org.junit.Test;
public class InjectIntoPatternTest {
public class InjectIntoPatternUnitTest {
@Test
public void whenInjectInto_thenCorrect() {

View File

@ -6,7 +6,7 @@ import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.impl.factory.Lists;
import org.junit.Test;
public class LazyIterationTest {
public class LazyIterationUnitTest {
@Test
public void whenLazyIteration_thenCorrect() {

View File

@ -8,7 +8,7 @@ import org.eclipse.collections.impl.list.mutable.FastList;
import org.junit.Before;
import org.junit.Test;
public class PartitionPatternTest {
public class PartitionPatternUnitTest {
MutableList<Integer> list;

View File

@ -7,7 +7,7 @@ import org.eclipse.collections.impl.list.mutable.FastList;
import org.junit.Before;
import org.junit.Test;
public class RejectPatternTest {
public class RejectPatternUnitTest {
MutableList<Integer> list;
MutableList<Integer> expectedList;

View File

@ -7,7 +7,7 @@ import org.eclipse.collections.impl.list.mutable.FastList;
import org.junit.Before;
import org.junit.Test;
public class SelectPatternTest {
public class SelectPatternUnitTest {
MutableList<Integer> list;

View File

@ -9,7 +9,7 @@ import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Test;
public class ZipTest {
public class ZipUnitTest {
MutableList<Pair<String, String>> expectedPairs;

View File

@ -9,7 +9,7 @@ import org.eclipse.collections.impl.tuple.Tuples;
import org.junit.Before;
import org.junit.Test;
public class ZipWithIndexTest {
public class ZipWithIndexUnitTest {
MutableList<Pair<String, Integer>> expectedPairs;

View File

@ -11,7 +11,7 @@ import fj.data.Option;
import fj.function.Characters;
import fj.function.Integers;
public class FunctionalJavaTest {
public class FunctionalJavaUnitTest {
public static final F<Integer, Boolean> isEven = i -> i % 2 == 0;

View File

@ -8,10 +8,12 @@ import org.infinispan.Cache;
import org.infinispan.manager.DefaultCacheManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import java.util.function.Supplier;
public class ConfigurationTest {
@Ignore
public abstract class AbstractIntegrationTest {
private DefaultCacheManager cacheManager;

View File

@ -1,11 +1,11 @@
package com.baeldung.infinispan.service;
import com.baeldung.infinispan.ConfigurationTest;
import com.baeldung.infinispan.AbstractIntegrationTest;
import org.junit.Test;
import static org.assertj.core.api.Java6Assertions.assertThat;
public class HelloWorldServiceIntegrationTest extends ConfigurationTest {
public class HelloWorldServiceIntegrationTest extends AbstractIntegrationTest {
@Test
public void whenGetIsCalledTwoTimes_thenTheSecondShouldHitTheCache() {

View File

@ -1,11 +1,11 @@
package com.baeldung.infinispan.service;
import com.baeldung.infinispan.ConfigurationTest;
import com.baeldung.infinispan.AbstractIntegrationTest;
import org.junit.Test;
import static org.assertj.core.api.Java6Assertions.assertThat;
public class TransactionalServiceIntegrationTest extends ConfigurationTest {
public class TransactionalServiceIntegrationTest extends AbstractIntegrationTest {
@Test
public void whenLockingAnEntry_thenItShouldBeInaccessible() throws InterruptedException {

View File

@ -5,7 +5,7 @@ import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class AppTest {
public class JDeferredUnitTest {
@Test
public void givenJob_expectPromise() {

View File

@ -86,7 +86,6 @@ public class JodaTimeUnitTest {
DateTimeUtils.setCurrentMillisFixed(currentTimestamp);
LocalDateTime currentDateAndTime = LocalDateTime.now();
assertEquals(currentTimestamp, currentDateAndTime.toDate().getTime());
assertEquals(new DateTime(currentTimestamp), currentDateAndTime.toDateTime());
assertEquals(new LocalDate(currentTimestamp), currentDateAndTime.toLocalDate());
assertEquals(new LocalTime(currentTimestamp), currentDateAndTime.toLocalTime());
@ -182,9 +181,6 @@ public class JodaTimeUnitTest {
DateTime convertedDateTime = localDateTimeInChicago.toDateTime(DateTimeZone.forID("Europe/Bucharest"));
assertEquals("2018-06-21T15:26:23.288+03:00", convertedDateTime.toString());
Date convertedDate = localDateTimeInChicago.toDate(TimeZone.getTimeZone("Europe/Bucharest"));
assertEquals("Thu Jun 21 15:26:23 EEST 2018", convertedDate.toString());
}
}

View File

@ -21,7 +21,7 @@ import static junit.framework.Assert.assertTrue;
import static junit.framework.TestCase.assertEquals;
import static org.jooq.lambda.tuple.Tuple.tuple;
public class JOOLTest {
public class JOOLUnitTest {
@Test
public void givenSeq_whenCheckContains_shouldReturnTrue() {
List<Integer> concat = Seq.of(1, 2, 3).concat(Seq.of(4, 5, 6)).toList();

View File

@ -9,7 +9,7 @@ import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
@RunWith(JUnitParamsRunner.class)
public class SafeAdditionUtilTest {
public class SafeAdditionUtilUnitTest {
private SafeAdditionUtil serviceUnderTest = new SafeAdditionUtil();

View File

@ -11,7 +11,7 @@ import static org.awaitility.Awaitility.await;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertNotNull;
public class MBassadorAsyncDispatchTest {
public class MBassadorAsyncDispatchUnitTest {
private MBassador dispatcher = new MBassador<String>();
private String testString;

View File

@ -13,7 +13,7 @@ import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
public class MBassadorAsyncInvocationTest {
public class MBassadorAsyncInvocationUnitTest {
private MBassador dispatcher = new MBassador<Integer>();

View File

@ -11,7 +11,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class MBassadorBasicTest {
public class MBassadorBasicUnitTest {
private MBassador dispatcher = new MBassador();

View File

@ -12,7 +12,7 @@ import java.util.*;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.*;
public class MBassadorConfigurationTest implements IPublicationErrorHandler {
public class MBassadorConfigurationUnitTest implements IPublicationErrorHandler {
private MBassador dispatcher;
private String messageString;

View File

@ -14,7 +14,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
public class MBassadorFilterTest {
public class MBassadorFilterUnitTest {
private MBassador dispatcher = new MBassador();

View File

@ -7,7 +7,7 @@ import org.junit.Test;
import static org.junit.Assert.*;
public class MBassadorHierarchyTest {
public class MBassadorHierarchyUnitTest {
private MBassador dispatcher = new MBassador<Message>();

View File

@ -20,7 +20,7 @@ import tec.units.ri.quantity.Quantities;
import tec.units.ri.unit.MetricPrefix;
import static tec.units.ri.unit.Units.*;
public class WaterTankTests {
public class WaterTankUnitTest {
@Test
public void givenQuantity_whenGetUnitAndConvertValue_thenSuccess() {

View File

@ -5,7 +5,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class OpenCsvTest {
public class OpenCsvIntegrationTest {
private Object testReadCsv(Object result) {
assert (result != null);

View File

@ -13,7 +13,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class CollectorUtilsTests {
public class CollectorUtilsUnitTest {
@Test
public void givenIntegerStream_whenCollectOnMaxByProjection_shouldReturnOptionalMaxValue() {

View File

@ -18,7 +18,7 @@ import static java.util.stream.Collectors.toList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
public class StreamUtilsTests {
public class StreamUtilsUnitTest {
@Test
public void givenStream_whenZipWithIndex_shouldReturnZippedStreamWithIndex() {
@ -174,7 +174,7 @@ public class StreamUtilsTests {
public void givenLimit_withIndices_shouldReturnLongStreamUptoLimit() {
LongStream indices = StreamUtils.indices().limit(500);
assertThat(indices.count(), equalTo(500));
assertThat(indices.count(), equalTo(500L));
}
}

View File

@ -10,7 +10,7 @@ import java.util.stream.Stream;
import static junit.framework.TestCase.assertEquals;
public class JoolMergeStreamsTest {
public class JoolMergeStreamsUnitTest {
@Test
public void givenTwoStreams_whenMergingStreams_thenResultingStreamContainsElementsFromBothStreams() {
Stream<Integer> seq1 = Stream.of(1, 3, 5);

View File

@ -9,7 +9,7 @@ import java.util.stream.Stream;
import static org.junit.Assert.assertEquals;
public class MergeStreamsTest {
public class MergeStreamsUnitTest {
@Test
public void givenTwoStreams_whenMergingStreams_thenResultingStreamContainsElementsFromBothStreams() {

View File

@ -9,7 +9,7 @@ import java.util.stream.Stream;
import static org.junit.Assert.assertEquals;
public class StreamExMergeStreamsTest {
public class StreamExMergeStreamsUnitTest {
@Test
public void givenTwoStreams_whenMergingStreams_thenResultingStreamContainsElementsFromBothStreams() {

View File

@ -16,7 +16,7 @@ import org.springframework.util.StreamUtils;
import static com.baeldung.streamutils.CopyStream.getStringFromInputStream;
public class CopyStreamTest {
public class CopyStreamUnitTest {
@Test
public void whenCopyInputStreamToOutputStream_thenCorrect() throws IOException {

View File

@ -5,7 +5,7 @@ import org.apache.commons.text.diff.StringsComparator;
import org.junit.Assert;
import org.junit.Test;
public class DiffTest {
public class DiffUnitTest {
@Test
public void whenEditScript_thenCorrect() {

View File

@ -5,7 +5,7 @@ import org.apache.commons.text.similarity.LongestCommonSubsequenceDistance;
import org.junit.Assert;
import org.junit.Test;
public class LongestCommonSubsequenceTest {
public class LongestCommonSubsequenceUnitTest {
@Test
public void whenCompare_thenCorrect() {

View File

@ -4,7 +4,7 @@ import org.apache.commons.text.StrBuilder;
import org.junit.Assert;
import org.junit.Test;
public class StrBuilderTest {
public class StrBuilderUnitTest {
@Test
public void whenReplaced_thenCorrect() {

View File

@ -7,7 +7,7 @@ import org.apache.commons.text.StrSubstitutor;
import org.junit.Assert;
import org.junit.Test;
public class StrSubstitutorTest {
public class StrSubstitutorUnitTest {
@Test
public void whenSubstituted_thenCorrect() {

View File

@ -4,7 +4,7 @@ import org.apache.commons.text.translate.UnicodeEscaper;
import org.junit.Assert;
import org.junit.Test;
public class UnicodeEscaperTest {
public class UnicodeEscaperUnitTest {
@Test
public void whenTranslate_thenCorrect() {

View File

@ -27,7 +27,7 @@ import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.async.Callback;
import com.mashape.unirest.http.exceptions.UnirestException;
public class HttpClientTest {
public class HttpClientLiveTest {
@BeforeClass
public static void setup() {

View File

@ -92,7 +92,7 @@
<module>jsoup</module>
<module>testing-modules/junit-5</module>
<module>jws</module>
<!--<module>libraries</module>-->
<module>libraries</module>
<module>libraries-data</module>
<module>linkrest</module>
<module>logging-modules/log-mdc</module>
@ -375,8 +375,8 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.9.0</version>
<dependencies>
<version>3.8</version>
<dependencies>
<dependency>
<groupId>org.baeldung.pmd</groupId>
<artifactId>custom-pmd</artifactId>
@ -395,6 +395,9 @@
<rulesets>
<ruleset>${tutorialsproject.basedir}/baeldung-pmd-rules.xml</ruleset>
</rulesets>
<excludeRoots>
<excludeRoot>target/generated-sources</excludeRoot>
</excludeRoots>
</configuration>
<executions>
<execution>