Hexagonal pattern: More descriptive class names

This commit is contained in:
Ilkka Seppälä
2016-09-09 21:36:17 +03:00
parent 1b10ddbb73
commit 0f2807b9cf
13 changed files with 188 additions and 240 deletions

View File

@@ -23,18 +23,18 @@
package com.iluwatar.hexagonal;
import com.google.inject.AbstractModule;
import com.iluwatar.hexagonal.administration.ConsoleAdministration;
import com.iluwatar.hexagonal.administration.LotteryAdministration;
import com.iluwatar.hexagonal.administration.LotteryAdministrationImpl;
import com.iluwatar.hexagonal.banking.InMemoryBank;
import com.iluwatar.hexagonal.banking.WireTransfers;
import com.iluwatar.hexagonal.banking.WireTransfersImpl;
import com.iluwatar.hexagonal.database.LotteryTicketInMemoryRepository;
import com.iluwatar.hexagonal.database.InMemoryTicketRepository;
import com.iluwatar.hexagonal.database.LotteryTicketRepository;
import com.iluwatar.hexagonal.domain.LotterySystem;
import com.iluwatar.hexagonal.domain.LotterySystemImpl;
import com.iluwatar.hexagonal.notifications.LotteryNotifications;
import com.iluwatar.hexagonal.notifications.LotteryNotificationsImpl;
import com.iluwatar.hexagonal.notifications.StdOutNotifications;
import com.iluwatar.hexagonal.service.ConsoleService;
import com.iluwatar.hexagonal.service.LotteryService;
import com.iluwatar.hexagonal.service.LotteryServiceImpl;
/**
* Guice module for testing dependencies
@@ -42,11 +42,11 @@ import com.iluwatar.hexagonal.service.LotteryServiceImpl;
public class LotteryTestingModule extends AbstractModule {
@Override
protected void configure() {
bind(LotteryTicketRepository.class).to(LotteryTicketInMemoryRepository.class);
bind(LotteryTicketRepository.class).to(InMemoryTicketRepository.class);
bind(LotterySystem.class).to(LotterySystemImpl.class);
bind(LotteryNotifications.class).to(LotteryNotificationsImpl.class);
bind(WireTransfers.class).to(WireTransfersImpl.class);
bind(LotteryAdministration.class).to(LotteryAdministrationImpl.class);
bind(LotteryService.class).to(LotteryServiceImpl.class);
bind(LotteryNotifications.class).to(StdOutNotifications.class);
bind(WireTransfers.class).to(InMemoryBank.class);
bind(LotteryAdministration.class).to(ConsoleAdministration.class);
bind(LotteryService.class).to(ConsoleService.class);
}
}

View File

@@ -34,7 +34,7 @@ import org.junit.Test;
*/
public class WireTransfersTest {
private final WireTransfers bank = new WireTransfersImpl();
private final WireTransfers bank = new InMemoryBank();
@Test
public void testInit() {

View File

@@ -30,8 +30,6 @@ import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import com.iluwatar.hexagonal.database.LotteryTicketRepository;
import com.iluwatar.hexagonal.database.LotteryTicketInMemoryRepository;
import com.iluwatar.hexagonal.domain.LotteryTicket;
import com.iluwatar.hexagonal.domain.LotteryTicketId;
import com.iluwatar.hexagonal.test.LotteryTestUtils;
@@ -43,7 +41,7 @@ import com.iluwatar.hexagonal.test.LotteryTestUtils;
*/
public class LotteryTicketRepositoryTest {
private final LotteryTicketRepository repository = new LotteryTicketInMemoryRepository();
private final LotteryTicketRepository repository = new InMemoryTicketRepository();
@Before
public void clear() {
@@ -52,7 +50,7 @@ public class LotteryTicketRepositoryTest {
@Test
public void testCrudOperations() {
LotteryTicketRepository repository = new LotteryTicketInMemoryRepository();
LotteryTicketRepository repository = new InMemoryTicketRepository();
assertEquals(repository.findAll().size(), 0);
LotteryTicket ticket = LotteryTestUtils.createLotteryTicket();
Optional<LotteryTicketId> id = repository.save(ticket);

View File

@@ -33,16 +33,11 @@ import java.util.Optional;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.iluwatar.hexagonal.LotteryModule;
import com.iluwatar.hexagonal.LotteryTestingModule;
import com.iluwatar.hexagonal.domain.*;
import org.junit.Before;
import org.junit.Test;
import com.iluwatar.hexagonal.banking.WireTransfers;
import com.iluwatar.hexagonal.banking.WireTransfersImpl;
import com.iluwatar.hexagonal.database.LotteryTicketRepository;
import com.iluwatar.hexagonal.database.LotteryTicketInMemoryRepository;
import com.iluwatar.hexagonal.domain.LotteryTicketCheckResult.CheckResult;
import com.iluwatar.hexagonal.test.LotteryTestUtils;