diff --git a/async-method-invocation/pom.xml b/async-method-invocation/pom.xml index c6764f61cad..49e39009ebd 100644 --- a/async-method-invocation/pom.xml +++ b/async-method-invocation/pom.xml @@ -43,5 +43,10 @@ mockito-core test + + junit + junit + test + diff --git a/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java b/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java index 2ceb66e3bdc..1d921da5103 100644 --- a/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java +++ b/bytecode/src/main/java/com/iluwatar/bytecode/Instruction.java @@ -29,7 +29,7 @@ public enum Instruction { LITERAL(1), SET_HEALTH(2), - SET_WISDOM (3), + SET_WISDOM(3), SET_AGILITY(4), PLAY_SOUND(5), SPAWN_PARTICLES(6), @@ -37,7 +37,7 @@ public enum Instruction { GET_AGILITY(8), GET_WISDOM(9), ADD(10), - DIVIDE (11); + DIVIDE(11); private int value; diff --git a/caching/pom.xml b/caching/pom.xml index 76578b8830c..c20e29e922d 100644 --- a/caching/pom.xml +++ b/caching/pom.xml @@ -65,7 +65,6 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19 false diff --git a/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java b/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java index 9f7c92b2eef..6b7fc35c3ac 100644 --- a/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java +++ b/caching/src/main/java/com/iluwatar/caching/CachingPolicy.java @@ -32,7 +32,7 @@ public enum CachingPolicy { private String policy; - private CachingPolicy(String policy) { + CachingPolicy(String policy) { this.policy = policy; } diff --git a/commander/src/main/java/com/iluwatar/commander/Commander.java b/commander/src/main/java/com/iluwatar/commander/Commander.java index 87d4604d4ac..8f19d1df879 100644 --- a/commander/src/main/java/com/iluwatar/commander/Commander.java +++ b/commander/src/main/java/com/iluwatar/commander/Commander.java @@ -239,12 +239,12 @@ private void updateQueue(QueueTask qt) throws InterruptedException { //since payment time is lesser than queuetime it would have already failed..additional check not needed LOG.trace("Order " + qt.order.id + ": Queue time for order over, failed.."); return; - } else if ((qt.taskType.equals(TaskType.Payment) && !qt.order.paid.equals(PaymentStatus.Trying)) - || (qt.taskType.equals(TaskType.Messaging) && ((qt.messageType == 1 - && !qt.order.messageSent.equals(MessageSent.NoneSent)) + } else if (qt.taskType.equals(TaskType.Payment) && !qt.order.paid.equals(PaymentStatus.Trying) + || qt.taskType.equals(TaskType.Messaging) && (qt.messageType == 1 + && !qt.order.messageSent.equals(MessageSent.NoneSent) || qt.order.messageSent.equals(MessageSent.PaymentFail) - || qt.order.messageSent.equals(MessageSent.PaymentSuccessful))) - || (qt.taskType.equals(TaskType.EmployeeDb) && qt.order.addedToEmployeeHandle)) { + || qt.order.messageSent.equals(MessageSent.PaymentSuccessful)) + || qt.taskType.equals(TaskType.EmployeeDb) && qt.order.addedToEmployeeHandle) { LOG.trace("Order " + qt.order.id + ": Not queueing task since task already done.."); return; } @@ -576,8 +576,8 @@ private void doTasksInQueue() throws Exception { || qt.order.messageSent.equals(MessageSent.PaymentSuccessful)) { tryDequeue(); LOG.trace("Order " + qt.order.id + ": This messaging task already done, dequeue.."); - } else if ((qt.messageType == 1 && (!qt.order.messageSent.equals(MessageSent.NoneSent) - || !qt.order.paid.equals(PaymentStatus.Trying)))) { + } else if (qt.messageType == 1 && (!qt.order.messageSent.equals(MessageSent.NoneSent) + || !qt.order.paid.equals(PaymentStatus.Trying))) { tryDequeue(); LOG.trace("Order " + qt.order.id + ": This messaging task does not need to be done, dequeue.."); } else if (qt.messageType == 0) { @@ -606,8 +606,7 @@ private void doTasksInQueue() throws Exception { } else { Thread.sleep(queueTaskTime / 3); tryDoingTasksInQueue(); - } - return; + } } } diff --git a/commander/src/main/java/com/iluwatar/commander/queue/Queue.java b/commander/src/main/java/com/iluwatar/commander/queue/Queue.java index f1b0ef53311..440f65c9093 100644 --- a/commander/src/main/java/com/iluwatar/commander/queue/Queue.java +++ b/commander/src/main/java/com/iluwatar/commander/queue/Queue.java @@ -83,7 +83,7 @@ T dequeue() throws IsEmptyException { Node temp = front; front = front.next; size = size - 1; - return ((T) temp.value); + return (T) temp.value; } } @@ -91,7 +91,7 @@ T peek() throws IsEmptyException { if (isEmpty()) { throw new IsEmptyException(); } else { - return ((T)front.value); + return (T)front.value; } } } diff --git a/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java b/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java index c814f98bc58..3a9faf4dca1 100644 --- a/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java +++ b/double-checked-locking/src/main/java/com/iluwatar/doublechecked/locking/App.java @@ -55,7 +55,9 @@ public static void main(String[] args) { ExecutorService executorService = Executors.newFixedThreadPool(3); for (int i = 0; i < 3; i++) { executorService.execute(() -> { - while (inventory.addItem(new Item())) {}; + while (inventory.addItem(new Item())) { + LOGGER.info("Adding another item"); + } }); } diff --git a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java index 5dc069bc703..c22f54ca0e2 100644 --- a/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java +++ b/event-asynchronous/src/main/java/com/iluwatar/event/asynchronous/Event.java @@ -97,7 +97,7 @@ public final void removeListener(final ThreadCompleteListener listener) { this.eventListener = null; } - private final void completed() { + private void completed() { if (eventListener != null) { eventListener.completedEventHandler(eventId); } diff --git a/exclude-pmd.properties b/exclude-pmd.properties index 288ee9b2d31..5a4bb138834 100644 --- a/exclude-pmd.properties +++ b/exclude-pmd.properties @@ -24,3 +24,4 @@ com.iluwatar.servicelayer.common.BaseEntity=UnusedPrivateField com.iluwatar.doublechecked.locking.App=EmptyStatementNotInLoop,EmptyWhileStmt com.iluwatar.doublechecked.locking.InventoryTest=EmptyStatementNotInLoop,EmptyWhileStmt +domainapp.dom.modules.simple.QSimpleObject=UnusedFormalParameter \ No newline at end of file diff --git a/flux/src/main/java/com/iluwatar/flux/action/Content.java b/flux/src/main/java/com/iluwatar/flux/action/Content.java index 596b466db41..8854ebced07 100644 --- a/flux/src/main/java/com/iluwatar/flux/action/Content.java +++ b/flux/src/main/java/com/iluwatar/flux/action/Content.java @@ -34,7 +34,7 @@ public enum Content { private String title; - private Content(String title) { + Content(String title) { this.title = title; } diff --git a/half-sync-half-async/pom.xml b/half-sync-half-async/pom.xml index d965298ca36..2ca43a96484 100644 --- a/half-sync-half-async/pom.xml +++ b/half-sync-half-async/pom.xml @@ -43,5 +43,10 @@ mockito-core test + + junit + junit + test + diff --git a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java index 9956788ad10..2d2a5331862 100644 --- a/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java +++ b/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleLottery.java @@ -48,7 +48,7 @@ public static void main(String[] args) { Injector injector = Guice.createInjector(new LotteryModule()); LotteryService service = injector.getInstance( LotteryService.class); WireTransfers bank = injector.getInstance(WireTransfers.class); - try (final Scanner scanner = new Scanner(System.in)) { + try (Scanner scanner = new Scanner(System.in)) { boolean exit = false; while (!exit) { printMainMenu(); diff --git a/naked-objects/pom.xml b/naked-objects/pom.xml index 8c21504bb6f..d0fe727d320 100644 --- a/naked-objects/pom.xml +++ b/naked-objects/pom.xml @@ -90,31 +90,9 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.8 - 1.8 - -parameters - - - - source - compile - - - test - test-compile - - - - org.apache.maven.plugins maven-surefire-plugin - 2.16 **/*Test.java diff --git a/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java b/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java index cd2d2da6ac9..e9937d30cac 100644 --- a/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java +++ b/poison-pill/src/main/java/com/iluwatar/poison/pill/Message.java @@ -66,7 +66,7 @@ private RuntimeException poison() { /** * Enumeration of Type of Headers */ - public enum Headers { + enum Headers { DATE, SENDER } diff --git a/pom.xml b/pom.xml index 5dfb1fff437..d985b6c62fe 100644 --- a/pom.xml +++ b/pom.xml @@ -36,10 +36,9 @@ 4.12 5.0.2 ${junit.version}.2 - 1.0.2 1.0.2 - 3.0 - 0.7.2.201409121644 + 3.8.1 + 0.8.4 1.4 2.16.1 19.0 @@ -55,6 +54,7 @@ 1.0.0 2.0.1 2.8.5 + 3.12.0 abstract-factory @@ -353,20 +353,27 @@ + + org.apache.maven.plugins + maven-compiler-plugin + ${compiler.version} + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M3 + + -Xmx1024M ${argLine} + + - - - org.apache.maven.plugins - maven-compiler-plugin - ${compiler.version} - - 1.8 - 1.8 - - org.jacoco jacoco-maven-plugin @@ -387,7 +394,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 2.17 + 3.1.0 validate @@ -406,25 +413,10 @@ - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - - org.junit.platform - junit-platform-surefire-provider - ${junit-platform.version} - - - - -Xmx1024M ${argLine} - - org.apache.maven.plugins maven-pmd-plugin - 3.6 + ${pmd.version} true 5 @@ -445,7 +437,7 @@ com.mycila license-maven-plugin - 2.11 + 3.0
com/mycila/maven/plugin/license/templates/MIT.txt
@@ -471,7 +463,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.6 + ${pmd.version}
diff --git a/retry/src/test/java/com/iluwatar/retry/RetryTest.java b/retry/src/test/java/com/iluwatar/retry/RetryTest.java index a8307d1cd9f..d435c7e8433 100644 --- a/retry/src/test/java/com/iluwatar/retry/RetryTest.java +++ b/retry/src/test/java/com/iluwatar/retry/RetryTest.java @@ -43,7 +43,8 @@ public class RetryTest { public void errors() { final BusinessException e = new BusinessException("unhandled"); final Retry retry = new Retry<>( - () -> { throw e; }, + () -> { + throw e; }, 2, 0 ); @@ -67,7 +68,8 @@ public void errors() { public void attempts() { final BusinessException e = new BusinessException("unhandled"); final Retry retry = new Retry<>( - () -> { throw e; }, + () -> { + throw e; }, 2, 0 ); @@ -91,7 +93,8 @@ public void attempts() { public void ignore() throws Exception { final BusinessException e = new CustomerNotFoundException("customer not found"); final Retry retry = new Retry<>( - () -> { throw e; }, + () -> { + throw e; }, 2, 0, ex -> CustomerNotFoundException.class.isAssignableFrom(ex.getClass()) diff --git a/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java b/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java index 88255997fa7..9ab004c1753 100644 --- a/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java +++ b/semaphore/src/main/java/com/iluwatar/semaphore/Fruit.java @@ -30,7 +30,7 @@ public class Fruit { /** * Enumeration of Fruit Types */ - public static enum FruitType { + public enum FruitType { ORANGE, APPLE, LEMON } diff --git a/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java b/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java index 52c24292e2e..bf3988d0748 100644 --- a/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java +++ b/service-layer/src/main/java/com/iluwatar/servicelayer/common/BaseEntity.java @@ -25,10 +25,9 @@ import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.MappedSuperclass; -import javax.persistence.Version; /** - * + * * Base class for entities. * */ @@ -36,9 +35,6 @@ @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract class BaseEntity { - @Version - private Long version; - /** * Indicates the unique id of this entity * diff --git a/trampoline/pom.xml b/trampoline/pom.xml index e6f2e620afa..1e019ef3129 100644 --- a/trampoline/pom.xml +++ b/trampoline/pom.xml @@ -62,7 +62,6 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19 false