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
@@ -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() {
@@ -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;
@@ -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;
@@ -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");
@@ -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" };
@@ -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() {
@@ -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>() {
{
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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;
@@ -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;
@@ -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() {
@@ -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
@@ -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;
@@ -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;
@@ -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
@@ -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() {
@@ -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() {
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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() {
@@ -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 {
@@ -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() {
@@ -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());
}
}
@@ -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();
@@ -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();
@@ -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;
@@ -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>();
@@ -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();
@@ -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;
@@ -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();
@@ -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>();
@@ -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() {
@@ -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);
@@ -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() {
@@ -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));
}
}
@@ -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);
@@ -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() {
@@ -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() {
@@ -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 {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {
@@ -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() {