Compare commits

..

14 Commits

Author SHA1 Message Date
0fad8b9b6c Addressed checkstyle issue 2018-10-21 17:20:52 +05:30
10179007e8 Addressed review comments 2018-10-21 17:19:41 +05:30
70b4931ab8 Removed unused import from Promise 2018-10-20 18:01:41 +05:30
543eb9a4be Minor refactorings and code style changes. 1) Removed several use of raw types 2) Removed unnecessary throws clauses 3) Used lambda expressions wherever applicable 4) Used apt assertion methods for readability 5) Use of try with resources wherever applicable 6) Corrected incorrect order of assertXXX arguments 2018-10-20 17:50:52 +05:30
2f569d670a Made minor changes in some patterns such as removed throws clause where not needed, changed incorrect order of arguments in assertEquals 2018-10-17 21:11:31 +05:30
db33cc533b Remove CII best practices badge 2018-10-13 18:40:10 +03:00
8433c7b712 Merge pull request #793 from andrievsky/master
Fix redundant list alloc in LotteryNumbers
2018-10-13 18:28:40 +03:00
ee74fec53c Fix pattern title 2018-09-30 21:36:32 +03:00
7a7e891384 Set version for next development iteration 2018-09-30 21:05:57 +03:00
26d6d96f78 Reach milestone 1.20.0 2018-09-30 21:03:48 +03:00
3cec7a9ec1 Merge pull request #796 from LyndonArmitage/module-ignore-test-output
Delete & Ignore output.txt & error.txt
2018-09-25 22:49:25 +03:00
b079aec1fd Merge pull request #794 from iluwatar/Issue781
#781 Resolved ClasscastException from Acyclic Visitor
2018-09-25 22:45:25 +03:00
8f53df91b9 Delete & Ignore output.txt & error.txt
Both output.txt and error.txt are produced by tests.
Each file contained a header that was overridden upon executing said
tests causing tracked files to be changed.

Added them to a local .gitignore file for this module.
2018-09-24 10:08:02 +01:00
1d12d94bac Fix redundant list alloc in LotteryNumbers 2018-09-11 11:55:53 +02:00
238 changed files with 442 additions and 640 deletions

View File

@ -8,7 +8,6 @@
[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/iluwatar/java-design-patterns/master/LICENSE.md)
[![Join the chat at https://gitter.im/iluwatar/java-design-patterns](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=com.iluwatar%3Ajava-design-patterns&metric=alert_status)](https://sonarcloud.io/dashboard/index/com.iluwatar%3Ajava-design-patterns)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1503/badge)](https://bestpractices.coreinfrastructure.org/projects/1503)
# Introduction

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>abstract-document</artifactId>
<dependencies>

View File

@ -32,6 +32,7 @@ import java.util.stream.Stream;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* AbstractDocument test class
@ -81,8 +82,8 @@ public class AbstractDocumentTest {
Map<String, Object> props = new HashMap<>();
props.put(KEY, VALUE);
DocumentImplementation document = new DocumentImplementation(props);
assertNotNull(document.toString().contains(KEY));
assertNotNull(document.toString().contains(VALUE));
assertTrue(document.toString().contains(KEY));
assertTrue(document.toString().contains(VALUE));
}
}

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>abstract-factory</artifactId>
<dependencies>

View File

@ -30,7 +30,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>acyclic-visitor</artifactId>

View File

@ -25,27 +25,19 @@ package com.iluwatar.acyclicvisitor;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.groups.Tuple.tuple;
import static uk.org.lidalia.slf4jext.Level.INFO;
import static org.mockito.Mockito.mock;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import uk.org.lidalia.slf4jtest.TestLogger;
import uk.org.lidalia.slf4jtest.TestLoggerFactory;
import org.junit.jupiter.api.Test;
import com.iluwatar.acyclicvisitor.ConfigureForUnixVisitor;
import com.iluwatar.acyclicvisitor.Hayes;
import com.iluwatar.acyclicvisitor.HayesVisitor;
import com.iluwatar.acyclicvisitor.Zoom;
import com.iluwatar.acyclicvisitor.ZoomVisitor;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
/**
* ConfigureForUnixVisitor test class
*/
public class ConfigureForUnixVisitorTest {
TestLogger logger = TestLoggerFactory.getTestLogger(ConfigureForUnixVisitor.class);
private static final TestLogger LOGGER = TestLoggerFactory.getTestLogger(ConfigureForUnixVisitor.class);
@AfterEach
public void clearLoggers() {
@ -59,7 +51,7 @@ public class ConfigureForUnixVisitorTest {
conUnix.visit(zoom);
assertThat(logger.getLoggingEvents()).extracting("level", "message").contains(
assertThat(LOGGER.getLoggingEvents()).extracting("level", "message").contains(
tuple(INFO, zoom + " used with Unix configurator."));
}
}

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>adapter</artifactId>
<dependencies>

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>aggregator-microservices</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>aggregator-microservices</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>aggregator-microservices</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -31,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
*/
public class InventoryControllerTest {
@Test
public void testGetProductInventories() throws Exception {
public void testGetProductInventories() {
InventoryController inventoryController = new InventoryController();
int numberOfInventories = inventoryController.getProductInventories();

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>aggregator-microservices</artifactId>

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ambassador</artifactId>

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>api-gateway</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>api-gateway-service</artifactId>

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>api-gateway</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>api-gateway</artifactId>

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>api-gateway</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>async-method-invocation</artifactId>
<dependencies>

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>bridge</artifactId>
<dependencies>

View File

@ -37,7 +37,7 @@ public class HammerTest extends WeaponTest {
* underlying weapon implementation.
*/
@Test
public void testHammer() throws Exception {
public void testHammer() {
final Hammer hammer = spy(new Hammer(mock(FlyingEnchantment.class)));
testBasicWeaponActions(hammer);
}

View File

@ -37,7 +37,7 @@ public class SwordTest extends WeaponTest {
* underlying weapon implementation.
*/
@Test
public void testSword() throws Exception {
public void testSword() {
final Sword sword = spy(new Sword(mock(FlyingEnchantment.class)));
testBasicWeaponActions(sword);
}

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>builder</artifactId>
<dependencies>

View File

@ -30,7 +30,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>business-delegate</artifactId>
<dependencies>

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>caching</artifactId>
<dependencies>

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>callback</artifactId>
<dependencies>

View File

@ -41,12 +41,7 @@ public class App {
*/
public static void main(String[] args) {
Task task = new SimpleTask();
Callback callback = new Callback() {
@Override
public void call() {
LOGGER.info("I'm done now.");
}
};
Callback callback = () -> LOGGER.info("I'm done now.");
task.executeWith(callback);
}
}

View File

@ -38,29 +38,6 @@ public class CallbackTest {
@Test
public void test() {
Callback callback = new Callback() {
@Override
public void call() {
callingCount++;
}
};
Task task = new SimpleTask();
assertEquals(new Integer(0), callingCount, "Initial calling count of 0");
task.executeWith(callback);
assertEquals(new Integer(1), callingCount, "Callback called once");
task.executeWith(callback);
assertEquals(new Integer(2), callingCount, "Callback called twice");
}
@Test
public void testWithLambdasExample() {
Callback callback = () -> callingCount++;
Task task = new SimpleTask();

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>chain</artifactId>
<dependencies>

View File

@ -43,7 +43,7 @@ public class OrcKingTest {
};
@Test
public void testMakeRequest() throws Exception {
public void testMakeRequest() {
final OrcKing king = new OrcKing();
for (final Request request : REQUESTS) {

View File

@ -27,7 +27,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>collection-pipeline</artifactId>
<dependencies>

View File

@ -26,10 +26,10 @@ package com.iluwatar.collectionpipeline;
* A Car class that has the properties of make, model, year and category.
*/
public class Car {
private String make;
private String model;
private int year;
private Category category;
private final String make;
private final String model;
private final int year;
private final Category category;
/**
* Constructor to create an instance of car.

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>command</artifactId>
<dependencies>

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>composite</artifactId>
<dependencies>

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<dependencies>

View File

@ -71,7 +71,7 @@ public class ConverterTest {
user.getFirstName().toLowerCase() + user.getLastName().toLowerCase() + "@whatever.com"));
User u1 = new User("John", "Doe", false, "12324");
UserDto userDto = converter.convertFromEntity(u1);
assertEquals(userDto.getEmail(), "johndoe@whatever.com");
assertEquals("johndoe@whatever.com", userDto.getEmail());
}
/**
@ -83,6 +83,6 @@ public class ConverterTest {
ArrayList<User> users = Lists.newArrayList(new User("Camile", "Tough", false, "124sad"),
new User("Marti", "Luther", true, "42309fd"), new User("Kate", "Smith", true, "if0243"));
List<User> fromDtos = userConverter.createFromDtos(userConverter.createFromEntities(users));
assertEquals(fromDtos, users);
assertEquals(users, fromDtos);
}
}

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>cqrs</artifactId>
<dependencies>

View File

@ -96,7 +96,7 @@ public class IntegrationTest {
@Test
public void testGetAuthorBooks() {
List<Book> books = queryService.getAuthorBooks("username1");
assertTrue(books.size() == 2);
assertEquals(2, books.size());
assertTrue(books.contains(new Book("title1", 10)));
assertTrue(books.contains(new Book("new_title2", 30)));
}

View File

@ -30,7 +30,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>dao</artifactId>

View File

@ -88,13 +88,7 @@ public class CustomerTest {
@Test
public void testToString() {
final StringBuffer buffer = new StringBuffer();
buffer.append("Customer{id=")
.append("" + customer.getId())
.append(", firstName='")
.append(customer.getFirstName())
.append("\', lastName='")
.append(customer.getLastName() + "\'}");
assertEquals(buffer.toString(), customer.toString());
assertEquals(String.format("Customer{id=%s, firstName='%s', lastName='%s'}",
customer.getId(), customer.getFirstName(), customer.getLastName()), customer.toString());
}
}

View File

@ -257,7 +257,7 @@ public class DbCustomerDaoTest {
private void assertCustomerCountIs(int count) throws Exception {
try (Stream<Customer> allCustomers = dao.getAll()) {
assertTrue(allCustomers.count() == count);
assertEquals(count, allCustomers.count());
}
}

View File

@ -156,7 +156,7 @@ public class InMemoryCustomerDaoTest {
private void assertCustomerCountIs(int count) throws Exception {
try (Stream<Customer> allCustomers = dao.getAll()) {
assertTrue(allCustomers.count() == count);
assertEquals(count, allCustomers.count());
}
}
}

View File

@ -33,7 +33,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>data-bus</artifactId>
<dependencies>

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>data-mapper</artifactId>
<dependencies>

View File

@ -21,6 +21,7 @@ package com.iluwatar.datamapper;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
/**
* The Data Mapper (DM) is a layer of software that separates the in-memory objects from the
@ -43,27 +44,29 @@ public class DataMapperTest {
final StudentDataMapper mapper = new StudentDataMapperImpl();
/* Create new student */
Student student = new Student(1, "Adam", 'A');
int studentId = 1;
Student student = new Student(studentId, "Adam", 'A');
/* Add student in respectibe db */
mapper.insert(student);
/* Check if student is added in db */
assertEquals(student.getStudentId(), mapper.find(student.getStudentId()).get().getStudentId());
assertEquals(studentId, mapper.find(student.getStudentId()).get().getStudentId());
/* Update existing student object */
student = new Student(student.getStudentId(), "AdamUpdated", 'A');
String updatedName = "AdamUpdated";
student = new Student(student.getStudentId(), updatedName, 'A');
/* Update student in respectibe db */
mapper.update(student);
/* Check if student is updated in db */
assertEquals(mapper.find(student.getStudentId()).get().getName(), "AdamUpdated");
assertEquals(updatedName, mapper.find(student.getStudentId()).get().getName());
/* Delete student in db */
mapper.delete(student);
/* Result should be false */
assertEquals(false, mapper.find(student.getStudentId()).isPresent());
assertFalse(mapper.find(student.getStudentId()).isPresent());
}
}

View File

@ -20,7 +20,9 @@ package com.iluwatar.datamapper;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
@ -28,28 +30,27 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
public final class StudentTest {
@Test
/**
* This API tests the equality behaviour of Student object
* Object Equality should work as per logic defined in equals method
*
* @throws Exception if any execution error during test
*/
@Test
public void testEquality() throws Exception {
/* Create some students */
final Student firstStudent = new Student(1, "Adam", 'A');
final Student secondStudent = new Student(2, "Donald", 'B');
final Student secondSameStudent = new Student(2, "Donald", 'B');
final Student firstSameStudent = firstStudent;
/* Check equals functionality: should return 'true' */
assertTrue(firstStudent.equals(firstSameStudent));
assertEquals(firstStudent, firstStudent);
/* Check equals functionality: should return 'false' */
assertFalse(firstStudent.equals(secondStudent));
assertNotEquals(firstStudent, secondStudent);
/* Check equals functionality: should return 'true' */
assertTrue(secondStudent.equals(secondSameStudent));
assertEquals(secondStudent, secondSameStudent);
}
}

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>data-transfer-object</artifactId>
<dependencies>

View File

@ -30,6 +30,7 @@ import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* tests {@link CustomerResource}.
@ -45,10 +46,10 @@ public class CustomerResourceTest {
List<CustomerDto> allCustomers = customerResource.getAllCustomers();
assertEquals(allCustomers.size(), 1);
assertEquals(allCustomers.get(0).getId(), "1");
assertEquals(allCustomers.get(0).getFirstName(), "Melody");
assertEquals(allCustomers.get(0).getLastName(), "Yates");
assertEquals(1, allCustomers.size());
assertEquals("1", allCustomers.get(0).getId());
assertEquals("Melody", allCustomers.get(0).getFirstName());
assertEquals("Yates", allCustomers.get(0).getLastName());
}
@Test
@ -59,9 +60,9 @@ public class CustomerResourceTest {
customerResource.save(customer);
List<CustomerDto> allCustomers = customerResource.getAllCustomers();
assertEquals(allCustomers.get(0).getId(), "1");
assertEquals(allCustomers.get(0).getFirstName(), "Rita");
assertEquals(allCustomers.get(0).getLastName(), "Reynolds");
assertEquals("1", allCustomers.get(0).getId());
assertEquals("Rita", allCustomers.get(0).getFirstName());
assertEquals("Reynolds", allCustomers.get(0).getLastName());
}
@Test
@ -75,7 +76,7 @@ public class CustomerResourceTest {
customerResource.delete(customer.getId());
List<CustomerDto> allCustomers = customerResource.getAllCustomers();
assertEquals(allCustomers.size(), 0);
assertTrue(allCustomers.isEmpty());
}
}

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>decorator</artifactId>
<dependencies>

View File

@ -30,7 +30,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -40,7 +40,7 @@ import com.iluwatar.delegation.simple.printers.HpPrinter;
*/
public class App {
public static final String MESSAGE_TO_PRINT = "hello world";
private static final String MESSAGE_TO_PRINT = "hello world";
/**
* Program entry point

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>dependency-injection</artifactId>
<dependencies>

View File

@ -29,11 +29,11 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<groupId>com.iluwatar</groupId>
<artifactId>dirty-flag</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
<name>dirty-flag</name>
<url>http://maven.apache.org</url>
<properties>

View File

@ -22,6 +22,7 @@
*/
package org.dirty.flag;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
@ -41,7 +42,7 @@ public class DirtyFlagTest {
public void testIsDirty() {
DataFetcher df = new DataFetcher();
List<String> countries = df.fetch();
assertTrue(!countries.isEmpty());
assertFalse(countries.isEmpty());
}
@Test

View File

@ -27,7 +27,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>double-checked-locking</artifactId>
<dependencies>

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>double-dispatch</artifactId>
<dependencies>

View File

@ -26,7 +26,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<dependencies>

View File

@ -51,7 +51,7 @@ public class AggregatorRoute extends RouteBuilder {
* @throws Exception in case of exception during configuration
*/
@Override
public void configure() throws Exception {
public void configure() {
// Main route
from("{{entry}}").aggregate(constant(true), aggregator)
.completionSize(3).completionInterval(2000)

View File

@ -30,7 +30,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>eip-message-channel</artifactId>
<dependencies>

View File

@ -70,7 +70,7 @@ public class App {
});
context.start();
context.getRoutes().stream().forEach(r -> LOGGER.info(r.toString()));
context.getRoutes().forEach(r -> LOGGER.info(r.toString()));
context.stop();
}
}

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>eip-publish-subscribe</artifactId>
<dependencies>

View File

@ -65,7 +65,7 @@ public class App {
});
ProducerTemplate template = context.createProducerTemplate();
context.start();
context.getRoutes().stream().forEach(r -> LOGGER.info(r.toString()));
context.getRoutes().forEach(r -> LOGGER.info(r.toString()));
template.sendBody("direct:origin", "Hello from origin");
context.stop();
}

View File

@ -26,7 +26,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<dependencies>

View File

@ -26,7 +26,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<dependencies>

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>event-aggregator</artifactId>
<dependencies>

View File

@ -76,7 +76,7 @@ public class KingJoffreyTest {
private class InMemoryAppender extends AppenderBase<ILoggingEvent> {
private List<ILoggingEvent> log = new LinkedList<>();
public InMemoryAppender(Class clazz) {
public InMemoryAppender(Class<?> clazz) {
((Logger) LoggerFactory.getLogger(clazz)).addAppender(this);
start();
}

View File

@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
public class WeekdayTest {
@Test
public void testToString() throws Exception {
public void testToString() {
for (final Weekday weekday : Weekday.values()) {
final String toString = weekday.toString();
assertNotNull(toString);

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>event-asynchronous</artifactId>
<dependencies>

View File

@ -16,11 +16,12 @@
*/
package com.iluwatar.event.asynchronous;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ -30,26 +31,19 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*
*/
public class EventAsynchronousTest {
App app;
private static final Logger LOGGER = LoggerFactory.getLogger(EventAsynchronousTest.class);
@BeforeEach
public void setUp() {
app = new App();
}
@Test
public void testAsynchronousEvent() {
EventManager eventManager = new EventManager();
try {
int aEventId = eventManager.createAsync(60);
eventManager.start(aEventId);
assertTrue(eventManager.getEventPool().size() == 1);
assertEquals(1, eventManager.getEventPool().size());
assertTrue(eventManager.getEventPool().size() < EventManager.MAX_RUNNING_EVENTS);
assertTrue(eventManager.numOfCurrentlyRunningSyncEvent() == -1);
assertEquals(-1, eventManager.numOfCurrentlyRunningSyncEvent());
eventManager.cancel(aEventId);
assertTrue(eventManager.getEventPool().size() == 0);
assertTrue(eventManager.getEventPool().isEmpty());
} catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException e) {
LOGGER.error(e.getMessage());
}
@ -61,11 +55,11 @@ public class EventAsynchronousTest {
try {
int sEventId = eventManager.create(60);
eventManager.start(sEventId);
assertTrue(eventManager.getEventPool().size() == 1);
assertEquals(1, eventManager.getEventPool().size());
assertTrue(eventManager.getEventPool().size() < EventManager.MAX_RUNNING_EVENTS);
assertTrue(eventManager.numOfCurrentlyRunningSyncEvent() != -1);
assertNotEquals(-1, eventManager.numOfCurrentlyRunningSyncEvent());
eventManager.cancel(sEventId);
assertTrue(eventManager.getEventPool().size() == 0);
assertTrue(eventManager.getEventPool().isEmpty());
} catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException
| InvalidOperationException e) {
LOGGER.error(e.getMessage());
@ -73,7 +67,7 @@ public class EventAsynchronousTest {
}
@Test
public void testUnsuccessfulSynchronousEvent() throws InvalidOperationException {
public void testUnsuccessfulSynchronousEvent() {
assertThrows(InvalidOperationException.class, () -> {
EventManager eventManager = new EventManager();
try {
@ -94,7 +88,7 @@ public class EventAsynchronousTest {
int eventTime = 1;
int sEventId = eventManager.create(eventTime);
assertTrue(eventManager.getEventPool().size() == 1);
assertEquals(1, eventManager.getEventPool().size());
eventManager.start(sEventId);
long currentTime = System.currentTimeMillis();
@ -104,7 +98,7 @@ public class EventAsynchronousTest {
while (System.currentTimeMillis() < endTime) {
}
assertTrue(eventManager.getEventPool().size() == 0);
assertTrue(eventManager.getEventPool().isEmpty());
} catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException
| InvalidOperationException e) {
@ -121,7 +115,7 @@ public class EventAsynchronousTest {
int aEventId1 = eventManager.createAsync(eventTime);
int aEventId2 = eventManager.createAsync(eventTime);
int aEventId3 = eventManager.createAsync(eventTime);
assertTrue(eventManager.getEventPool().size() == 3);
assertEquals(3, eventManager.getEventPool().size());
eventManager.start(aEventId1);
eventManager.start(aEventId2);
@ -133,7 +127,7 @@ public class EventAsynchronousTest {
while (System.currentTimeMillis() < endTime) {
}
assertTrue(eventManager.getEventPool().size() == 0);
assertTrue(eventManager.getEventPool().isEmpty());
} catch (MaxNumOfEventsAllowedException | LongRunningEventException | EventDoesNotExistException e) {
LOGGER.error(e.getMessage());

View File

@ -31,7 +31,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>event-driven-architecture</artifactId>

View File

@ -30,7 +30,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>event-queue</artifactId>
<dependencies>

View File

@ -30,7 +30,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>event-sourcing</artifactId>
<dependencies>

View File

@ -74,7 +74,7 @@ public class App {
LOGGER.info("Running the system first time............");
eventProcessor.reset();
LOGGER.info("Creating th accounts............");
LOGGER.info("Creating the accounts............");
eventProcessor.process(new AccountCreateEvent(
0, new Date().getTime(), ACCOUNT_OF_DAENERYS, "Daenerys Targaryen"));
@ -98,7 +98,7 @@ public class App {
LOGGER.info(AccountAggregate.getAccount(ACCOUNT_OF_DAENERYS).toString());
LOGGER.info(AccountAggregate.getAccount(ACCOUNT_OF_JON).toString());
LOGGER.info("At that point system had a shot down, state in memory is cleared............");
LOGGER.info("At that point system had a shut down, state in memory is cleared............");
AccountAggregate.resetState();
LOGGER.info("Recover the system by the events in journal file............");

View File

@ -92,7 +92,7 @@ public class MoneyTransferEvent extends DomainEvent {
}
Account accountTo = AccountAggregate.getAccount(accountNoTo);
if (accountTo == null) {
throw new RuntimeException("Account not found" + accountTo);
throw new RuntimeException("Account not found " + accountNoTo);
}
accountFrom.handleTransferFromEvent(this);

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>execute-around</artifactId>
<dependencies>

View File

@ -44,26 +44,17 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
@EnableRuleMigrationSupport
public class SimpleFileWriterTest {
/**
* Create a temporary folder, used to generate files in during this test
*/
@Rule
public final TemporaryFolder testFolder = new TemporaryFolder();
/**
* Verify if the given writer is not 'null'
*/
@Test
public void testWriterNotNull() throws Exception {
final File temporaryFile = this.testFolder.newFile();
new SimpleFileWriter(temporaryFile.getPath(), Assertions::assertNotNull);
}
/**
* Test if the {@link SimpleFileWriter} creates a file if it doesn't exist
*/
@Test
public void testNonExistentFile() throws Exception {
public void testCreatesNonExistentFile() throws Exception {
final File nonExistingFile = new File(this.testFolder.getRoot(), "non-existing-file");
assertFalse(nonExistingFile.exists());
@ -71,11 +62,8 @@ public class SimpleFileWriterTest {
assertTrue(nonExistingFile.exists());
}
/**
* Test if the data written to the file writer actually gets in the file
*/
@Test
public void testActualWrite() throws Exception {
public void testContentsAreWrittenToFile() throws Exception {
final String testMessage = "Test message";
final File temporaryFile = this.testFolder.newFile();
@ -85,17 +73,15 @@ public class SimpleFileWriterTest {
assertTrue(Files.lines(temporaryFile.toPath()).allMatch(testMessage::equals));
}
/**
* Verify if an {@link IOException} during the write ripples through
*/
@Test
public void testIoException() throws Exception {
public void testRipplesIoExceptionOccurredWhileWriting() {
String message = "Some error";
assertThrows(IOException.class, () -> {
final File temporaryFile = this.testFolder.newFile();
new SimpleFileWriter(temporaryFile.getPath(), writer -> {
throw new IOException("");
throw new IOException(message);
});
});
}, message);
}
}

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -32,16 +32,16 @@ import units.CommanderUnit;
*/
public class Commander implements CommanderExtension {
private static final Logger LOGGER = LoggerFactory.getLogger(Commander.class);
private CommanderUnit unit;
public Commander(CommanderUnit commanderUnit) {
this.unit = commanderUnit;
}
final Logger logger = LoggerFactory.getLogger(Commander.class);
@Override
public void commanderReady() {
logger.info("[Commander] " + unit.getName() + " is ready!");
LOGGER.info("[Commander] " + unit.getName() + " is ready!");
}
}

View File

@ -32,16 +32,16 @@ import units.SergeantUnit;
*/
public class Sergeant implements SergeantExtension {
private static final Logger LOGGER = LoggerFactory.getLogger(Sergeant.class);
private SergeantUnit unit;
public Sergeant(SergeantUnit sergeantUnit) {
this.unit = sergeantUnit;
}
final Logger logger = LoggerFactory.getLogger(Sergeant.class);
@Override
public void sergeantReady() {
logger.info("[Sergeant] " + unit.getName() + " is ready! ");
LOGGER.info("[Sergeant] " + unit.getName() + " is ready! ");
}
}

View File

@ -31,6 +31,7 @@ import units.SoldierUnit;
* Class defining Soldier
*/
public class Soldier implements SoldierExtension {
private static final Logger LOGGER = LoggerFactory.getLogger(Soldier.class);
private SoldierUnit unit;
@ -38,10 +39,8 @@ public class Soldier implements SoldierExtension {
this.unit = soldierUnit;
}
final Logger logger = LoggerFactory.getLogger(Soldier.class);
@Override
public void soldierReady() {
logger.info("[Solider] " + unit.getName() + " is ready!");
LOGGER.info("[Solider] " + unit.getName() + " is ready!");
}
}

View File

@ -30,7 +30,7 @@ import units.CommanderUnit;
*/
public class CommanderTest {
@Test
public void commanderReady() throws Exception {
public void commanderReady() {
final Commander commander = new Commander(new CommanderUnit("CommanderUnitTest"));
commander.commanderReady();

View File

@ -33,13 +33,13 @@ import static org.junit.jupiter.api.Assertions.assertNull;
*/
public class CommanderUnitTest {
@Test
public void getUnitExtension() throws Exception {
public void getUnitExtension() {
final Unit unit = new CommanderUnit("CommanderUnitName");
assertNull(unit.getUnitExtension("SoldierExtension"));
assertNull(unit.getUnitExtension("SergeantExtension"));
assertNotNull((CommanderExtension) unit.getUnitExtension("CommanderExtension"));
assertNotNull(unit.getUnitExtension("CommanderExtension"));
}
}

View File

@ -33,12 +33,12 @@ import static org.junit.jupiter.api.Assertions.assertNull;
*/
public class SergeantUnitTest {
@Test
public void getUnitExtension() throws Exception {
public void getUnitExtension() {
final Unit unit = new SergeantUnit("SergeantUnitName");
assertNull(unit.getUnitExtension("SoldierExtension"));
assertNotNull((SergeantExtension) unit.getUnitExtension("SergeantExtension"));
assertNotNull(unit.getUnitExtension("SergeantExtension"));
assertNull(unit.getUnitExtension("CommanderExtension"));
}

View File

@ -33,11 +33,11 @@ import static org.junit.jupiter.api.Assertions.assertNull;
*/
public class SoldierUnitTest {
@Test
public void getUnitExtension() throws Exception {
public void getUnitExtension() {
final Unit unit = new SoldierUnit("SoldierUnitName");
assertNotNull((SoldierExtension) unit.getUnitExtension("SoldierExtension"));
assertNotNull(unit.getUnitExtension("SoldierExtension"));
assertNull(unit.getUnitExtension("SergeantExtension"));
assertNull(unit.getUnitExtension("CommanderExtension"));

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>facade</artifactId>
<dependencies>

View File

@ -30,7 +30,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>factory-kit</artifactId>
<dependencies>

View File

@ -83,7 +83,7 @@ public class FactoryKitTest {
* @param weapon weapon object which is to be verified
* @param clazz expected class of the weapon
*/
private void verifyWeapon(Weapon weapon, Class clazz) {
private void verifyWeapon(Weapon weapon, Class<?> clazz) {
assertTrue(clazz.isInstance(weapon), "Weapon must be an object of: " + clazz.getName());
}
}

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>factory-method</artifactId>
<dependencies>

View File

@ -30,7 +30,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -40,14 +40,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class PropertiesFeatureToggleVersionTest {
@Test
public void testNullPropertiesPassed() throws Exception {
public void testNullPropertiesPassed() {
assertThrows(IllegalArgumentException.class, () -> {
new PropertiesFeatureToggleVersion(null);
});
}
@Test
public void testNonBooleanProperty() throws Exception {
public void testNonBooleanProperty() {
assertThrows(IllegalArgumentException.class, () -> {
final Properties properties = new Properties();
properties.setProperty("enhancedWelcome", "Something");
@ -56,7 +56,7 @@ public class PropertiesFeatureToggleVersionTest {
}
@Test
public void testFeatureTurnedOn() throws Exception {
public void testFeatureTurnedOn() {
final Properties properties = new Properties();
properties.put("enhancedWelcome", true);
Service service = new PropertiesFeatureToggleVersion(properties);
@ -66,7 +66,7 @@ public class PropertiesFeatureToggleVersionTest {
}
@Test
public void testFeatureTurnedOff() throws Exception {
public void testFeatureTurnedOff() {
final Properties properties = new Properties();
properties.put("enhancedWelcome", false);
Service service = new PropertiesFeatureToggleVersion(properties);

View File

@ -41,27 +41,27 @@ public class TieredFeatureToggleVersionTest {
final Service service = new TieredFeatureToggleVersion();
@BeforeEach
public void setUp() throws Exception {
public void setUp() {
UserGroup.addUserToPaidGroup(paidUser);
UserGroup.addUserToFreeGroup(freeUser);
}
@Test
public void testGetWelcomeMessageForPaidUser() throws Exception {
public void testGetWelcomeMessageForPaidUser() {
final String welcomeMessage = service.getWelcomeMessage(paidUser);
final String expected = "You're amazing Jamie Coder. Thanks for paying for this awesome software.";
assertEquals(expected, welcomeMessage);
}
@Test
public void testGetWelcomeMessageForFreeUser() throws Exception {
public void testGetWelcomeMessageForFreeUser() {
final String welcomeMessage = service.getWelcomeMessage(freeUser);
final String expected = "I suppose you can use this software.";
assertEquals(expected, welcomeMessage);
}
@Test
public void testIsEnhancedAlwaysTrueAsTiered() throws Exception {
public void testIsEnhancedAlwaysTrueAsTiered() {
assertTrue(service.isEnhanced());
}
}

View File

@ -29,7 +29,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -171,11 +171,11 @@ public class SimpleFluentIterable<E> implements FluentIterable<E> {
/**
* @return a FluentIterable from a given iterable. Calls the SimpleFluentIterable constructor.
*/
public static final <E> FluentIterable<E> from(Iterable<E> iterable) {
public static <E> FluentIterable<E> from(Iterable<E> iterable) {
return new SimpleFluentIterable<>(iterable);
}
public static final <E> FluentIterable<E> fromCopyOf(Iterable<E> iterable) {
public static <E> FluentIterable<E> fromCopyOf(Iterable<E> iterable) {
List<E> copy = FluentIterable.copyToList(iterable);
return new SimpleFluentIterable<>(copy);
}

View File

@ -179,15 +179,15 @@ public abstract class FluentIterableTest {
}
@Test
public void testForEach() throws Exception {
public void testForEach() {
final List<Integer> integers = Arrays.asList(1, 2, 3);
final Consumer<Integer> consumer = mock(Consumer.class);
createFluentIterable(integers).forEach(consumer);
verify(consumer, times(1)).accept(Integer.valueOf(1));
verify(consumer, times(1)).accept(Integer.valueOf(2));
verify(consumer, times(1)).accept(Integer.valueOf(3));
verify(consumer, times(1)).accept(1);
verify(consumer, times(1)).accept(2);
verify(consumer, times(1)).accept(3);
verifyNoMoreInteractions(consumer);
}

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>flux</artifactId>
<dependencies>

View File

@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>flyweight</artifactId>
<dependencies>

View File

@ -30,7 +30,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<artifactId>front-controller</artifactId>
<dependencies>

View File

@ -36,7 +36,7 @@ public class FrontController {
}
private Command getCommand(String request) {
Class commandClass = getCommandClass(request);
Class<?> commandClass = getCommandClass(request);
try {
return (Command) commandClass.newInstance();
} catch (Exception e) {
@ -44,8 +44,8 @@ public class FrontController {
}
}
private static Class getCommandClass(String request) {
Class result;
private static Class<?> getCommandClass(String request) {
Class<?> result;
try {
result = Class.forName("com.iluwatar.front.controller." + request + "Command");
} catch (ClassNotFoundException e) {

View File

@ -34,7 +34,7 @@ import static org.junit.jupiter.api.Assertions.assertSame;
public class ApplicationExceptionTest {
@Test
public void testCause() throws Exception {
public void testCause() {
final Exception cause = new Exception();
assertSame(cause, new ApplicationException(cause).getCause());
}

View File

@ -30,7 +30,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.20.0-SNAPSHOT</version>
<version>1.21.0-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>
<artifactId>guarded-suspension</artifactId>

Some files were not shown because too many files have changed in this diff Show More