mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-08-11 16:25:36 +00:00
deps: Refactor dependencies (#3224)
* remove spring dep move junit, logging, mockito under dep mgmt * upgrade anti-corruption-layer deps * async method invocation * balking, bloc * bridge to bytecode * caching * callback - cqrs * component - health check * hexagonal - metadata mapping * rest of the patterns * remove checkstyle, take spotless into use
This commit is contained in:
@@ -34,22 +34,21 @@ import com.iluwatar.servicelayer.wizard.Wizard;
|
||||
import com.iluwatar.servicelayer.wizard.WizardDaoImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
/**
|
||||
* Service layer defines an application's boundary with a layer of services that establishes a set
|
||||
* of available operations and coordinates the application's response in each operation.
|
||||
*
|
||||
* <p>Enterprise applications typically require different kinds of interfaces to the data they
|
||||
* store and the logic they implement: data loaders, user interfaces, integration gateways, and
|
||||
* others. Despite their different purposes, these interfaces often need common interactions with
|
||||
* the application to access and manipulate its data and invoke its business logic. The interactions
|
||||
* may be complex, involving transactions across multiple resources and the coordination of several
|
||||
* <p>Enterprise applications typically require different kinds of interfaces to the data they store
|
||||
* and the logic they implement: data loaders, user interfaces, integration gateways, and others.
|
||||
* Despite their different purposes, these interfaces often need common interactions with the
|
||||
* application to access and manipulate its data and invoke its business logic. The interactions may
|
||||
* be complex, involving transactions across multiple resources and the coordination of several
|
||||
* responses to an action. Encoding the logic of the interactions separately in each interface
|
||||
* causes a lot of duplication.
|
||||
*
|
||||
* <p>The example application demonstrates interactions between a client ({@link App}) and a
|
||||
* service ({@link MagicService}). The service is implemented with 3-layer architecture (entity,
|
||||
* dao, service). For persistence the example uses in-memory H2 database which is populated on each
|
||||
* <p>The example application demonstrates interactions between a client ({@link App}) and a service
|
||||
* ({@link MagicService}). The service is implemented with 3-layer architecture (entity, dao,
|
||||
* service). For persistence the example uses in-memory H2 database which is populated on each
|
||||
* application startup.
|
||||
*/
|
||||
@Slf4j
|
||||
@@ -68,9 +67,7 @@ public class App {
|
||||
queryData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize data.
|
||||
*/
|
||||
/** Initialize data. */
|
||||
public static void initData() {
|
||||
// spells
|
||||
var spell1 = new Spell("Ice dart");
|
||||
@@ -173,9 +170,7 @@ public class App {
|
||||
wizardDao.merge(wizard4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the data.
|
||||
*/
|
||||
/** Query the data. */
|
||||
public static void queryData() {
|
||||
var wizardDao = new WizardDaoImpl();
|
||||
var spellbookDao = new SpellbookDaoImpl();
|
||||
|
||||
@@ -24,15 +24,10 @@
|
||||
*/
|
||||
package com.iluwatar.servicelayer.common;
|
||||
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
|
||||
/**
|
||||
* Base class for entities.
|
||||
*/
|
||||
/** Base class for entities. */
|
||||
@MappedSuperclass
|
||||
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||
public abstract class BaseEntity {
|
||||
|
||||
/**
|
||||
@@ -62,5 +57,4 @@ public abstract class BaseEntity {
|
||||
* @param name The new name
|
||||
*/
|
||||
public abstract void setName(final String name);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
package com.iluwatar.servicelayer.common;
|
||||
|
||||
import com.iluwatar.servicelayer.hibernate.HibernateUtil;
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.CriteriaQuery;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.util.List;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.query.Query;
|
||||
@@ -42,8 +42,9 @@ import org.hibernate.query.Query;
|
||||
public abstract class DaoBaseImpl<E extends BaseEntity> implements Dao<E> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Class<E> persistentClass = (Class<E>) ((ParameterizedType) getClass()
|
||||
.getGenericSuperclass()).getActualTypeArguments()[0];
|
||||
protected Class<E> persistentClass =
|
||||
(Class<E>)
|
||||
((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
|
||||
|
||||
/*
|
||||
* Making this getSessionFactory() instead of getSession() so that it is the responsibility
|
||||
|
||||
+14
-18
@@ -31,19 +31,14 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
|
||||
/**
|
||||
* Produces the Hibernate {@link SessionFactory}.
|
||||
*/
|
||||
/** Produces the Hibernate {@link SessionFactory}. */
|
||||
@Slf4j
|
||||
public final class HibernateUtil {
|
||||
|
||||
/**
|
||||
* The cached session factory.
|
||||
*/
|
||||
/** The cached session factory. */
|
||||
private static volatile SessionFactory sessionFactory;
|
||||
|
||||
private HibernateUtil() {
|
||||
}
|
||||
private HibernateUtil() {}
|
||||
|
||||
/**
|
||||
* Create the current session factory instance, create a new one when there is none yet.
|
||||
@@ -53,15 +48,17 @@ public final class HibernateUtil {
|
||||
public static synchronized SessionFactory getSessionFactory() {
|
||||
if (sessionFactory == null) {
|
||||
try {
|
||||
sessionFactory = new Configuration()
|
||||
.addAnnotatedClass(Wizard.class)
|
||||
.addAnnotatedClass(Spellbook.class)
|
||||
.addAnnotatedClass(Spell.class)
|
||||
.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect")
|
||||
.setProperty("hibernate.connection.url", "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1")
|
||||
.setProperty("hibernate.current_session_context_class", "thread")
|
||||
.setProperty("hibernate.show_sql", "false")
|
||||
.setProperty("hibernate.hbm2ddl.auto", "create-drop").buildSessionFactory();
|
||||
sessionFactory =
|
||||
new Configuration()
|
||||
.addAnnotatedClass(Wizard.class)
|
||||
.addAnnotatedClass(Spellbook.class)
|
||||
.addAnnotatedClass(Spell.class)
|
||||
.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect")
|
||||
.setProperty("hibernate.connection.url", "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1")
|
||||
.setProperty("hibernate.current_session_context_class", "thread")
|
||||
.setProperty("hibernate.show_sql", "false")
|
||||
.setProperty("hibernate.hbm2ddl.auto", "create-drop")
|
||||
.buildSessionFactory();
|
||||
} catch (Throwable ex) {
|
||||
LOGGER.error("Initial SessionFactory creation failed.", ex);
|
||||
throw new ExceptionInInitializerError(ex);
|
||||
@@ -78,5 +75,4 @@ public final class HibernateUtil {
|
||||
getSessionFactory().close();
|
||||
sessionFactory = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,10 +29,7 @@ import com.iluwatar.servicelayer.spellbook.Spellbook;
|
||||
import com.iluwatar.servicelayer.wizard.Wizard;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Service interface.
|
||||
*/
|
||||
/** Service interface. */
|
||||
public interface MagicService {
|
||||
|
||||
List<Wizard> findAllWizards();
|
||||
|
||||
@@ -33,18 +33,14 @@ import com.iluwatar.servicelayer.wizard.WizardDao;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service implementation.
|
||||
*/
|
||||
/** Service implementation. */
|
||||
public class MagicServiceImpl implements MagicService {
|
||||
|
||||
private final WizardDao wizardDao;
|
||||
private final SpellbookDao spellbookDao;
|
||||
private final SpellDao spellDao;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
/** Constructor. */
|
||||
public MagicServiceImpl(WizardDao wizardDao, SpellbookDao spellbookDao, SpellDao spellDao) {
|
||||
this.wizardDao = wizardDao;
|
||||
this.spellbookDao = spellbookDao;
|
||||
|
||||
@@ -26,23 +26,24 @@ package com.iluwatar.servicelayer.spell;
|
||||
|
||||
import com.iluwatar.servicelayer.common.BaseEntity;
|
||||
import com.iluwatar.servicelayer.spellbook.Spellbook;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Inheritance;
|
||||
import jakarta.persistence.InheritanceType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* Spell entity.
|
||||
*/
|
||||
/** Spell entity. */
|
||||
@Entity
|
||||
@Table(name = "SPELL")
|
||||
@Getter
|
||||
@Setter
|
||||
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||
public class Spell extends BaseEntity {
|
||||
|
||||
private String name;
|
||||
@@ -56,8 +57,7 @@ public class Spell extends BaseEntity {
|
||||
@JoinColumn(name = "SPELLBOOK_ID_FK", referencedColumnName = "SPELLBOOK_ID")
|
||||
private Spellbook spellbook;
|
||||
|
||||
public Spell() {
|
||||
}
|
||||
public Spell() {}
|
||||
|
||||
public Spell(String name) {
|
||||
this();
|
||||
|
||||
@@ -26,11 +26,8 @@ package com.iluwatar.servicelayer.spell;
|
||||
|
||||
import com.iluwatar.servicelayer.common.Dao;
|
||||
|
||||
/**
|
||||
* SpellDao interface.
|
||||
*/
|
||||
/** SpellDao interface. */
|
||||
public interface SpellDao extends Dao<Spell> {
|
||||
|
||||
Spell findByName(String name);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,16 +25,13 @@
|
||||
package com.iluwatar.servicelayer.spell;
|
||||
|
||||
import com.iluwatar.servicelayer.common.DaoBaseImpl;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.CriteriaQuery;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.query.Query;
|
||||
|
||||
|
||||
/**
|
||||
* SpellDao implementation.
|
||||
*/
|
||||
/** SpellDao implementation. */
|
||||
public class SpellDaoImpl extends DaoBaseImpl<Spell> implements SpellDao {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,27 +27,28 @@ package com.iluwatar.servicelayer.spellbook;
|
||||
import com.iluwatar.servicelayer.common.BaseEntity;
|
||||
import com.iluwatar.servicelayer.spell.Spell;
|
||||
import com.iluwatar.servicelayer.wizard.Wizard;
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Inheritance;
|
||||
import jakarta.persistence.InheritanceType;
|
||||
import jakarta.persistence.ManyToMany;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* Spellbook entity.
|
||||
*/
|
||||
/** Spellbook entity. */
|
||||
@Entity
|
||||
@Table(name = "SPELLBOOK")
|
||||
@Getter
|
||||
@Setter
|
||||
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||
public class Spellbook extends BaseEntity {
|
||||
|
||||
@Id
|
||||
|
||||
@@ -26,11 +26,8 @@ package com.iluwatar.servicelayer.spellbook;
|
||||
|
||||
import com.iluwatar.servicelayer.common.Dao;
|
||||
|
||||
/**
|
||||
* SpellbookDao interface.
|
||||
*/
|
||||
/** SpellbookDao interface. */
|
||||
public interface SpellbookDao extends Dao<Spellbook> {
|
||||
|
||||
Spellbook findByName(String name);
|
||||
|
||||
}
|
||||
|
||||
+4
-8
@@ -25,16 +25,13 @@
|
||||
package com.iluwatar.servicelayer.spellbook;
|
||||
|
||||
import com.iluwatar.servicelayer.common.DaoBaseImpl;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.CriteriaQuery;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.query.Query;
|
||||
|
||||
|
||||
/**
|
||||
* SpellbookDao implementation.
|
||||
*/
|
||||
/** SpellbookDao implementation. */
|
||||
public class SpellbookDaoImpl extends DaoBaseImpl<Spellbook> implements SpellbookDao {
|
||||
|
||||
@Override
|
||||
@@ -58,5 +55,4 @@ public class SpellbookDaoImpl extends DaoBaseImpl<Spellbook> implements Spellboo
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,25 +26,26 @@ package com.iluwatar.servicelayer.wizard;
|
||||
|
||||
import com.iluwatar.servicelayer.common.BaseEntity;
|
||||
import com.iluwatar.servicelayer.spellbook.Spellbook;
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Inheritance;
|
||||
import jakarta.persistence.InheritanceType;
|
||||
import jakarta.persistence.ManyToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* Wizard entity.
|
||||
*/
|
||||
/** Wizard entity. */
|
||||
@Entity
|
||||
@Table(name = "WIZARD")
|
||||
@Getter
|
||||
@Setter
|
||||
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||
public class Wizard extends BaseEntity {
|
||||
|
||||
@Id
|
||||
|
||||
@@ -26,11 +26,8 @@ package com.iluwatar.servicelayer.wizard;
|
||||
|
||||
import com.iluwatar.servicelayer.common.Dao;
|
||||
|
||||
/**
|
||||
* WizardDao interface.
|
||||
*/
|
||||
/** WizardDao interface. */
|
||||
public interface WizardDao extends Dao<Wizard> {
|
||||
|
||||
Wizard findByName(String name);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,15 +25,13 @@
|
||||
package com.iluwatar.servicelayer.wizard;
|
||||
|
||||
import com.iluwatar.servicelayer.common.DaoBaseImpl;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
import jakarta.persistence.criteria.CriteriaBuilder;
|
||||
import jakarta.persistence.criteria.CriteriaQuery;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.query.Query;
|
||||
|
||||
/**
|
||||
* WizardDao implementation.
|
||||
*/
|
||||
/** WizardDao implementation. */
|
||||
public class WizardDaoImpl extends DaoBaseImpl<Wizard> implements WizardDao {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,25 +24,22 @@
|
||||
*/
|
||||
package com.iluwatar.servicelayer.app;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
import com.iluwatar.servicelayer.hibernate.HibernateUtil;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
/**
|
||||
* Application test
|
||||
*/
|
||||
/** Application test */
|
||||
class AppTest {
|
||||
|
||||
@Test
|
||||
void shouldExecuteWithoutException() {
|
||||
assertDoesNotThrow(() -> App.main(new String[]{}));
|
||||
assertDoesNotThrow(() -> App.main(new String[] {}));
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void tearDown() {
|
||||
HibernateUtil.dropSession();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,31 +43,23 @@ import org.junit.jupiter.api.Test;
|
||||
*/
|
||||
public abstract class BaseDaoTest<E extends BaseEntity, D extends DaoBaseImpl<E>> {
|
||||
|
||||
/**
|
||||
* The number of entities stored before each test
|
||||
*/
|
||||
/** The number of entities stored before each test */
|
||||
private static final int INITIAL_COUNT = 5;
|
||||
|
||||
/**
|
||||
* The unique id generator, shared between all entities
|
||||
*/
|
||||
/** The unique id generator, shared between all entities */
|
||||
private static final AtomicInteger ID_GENERATOR = new AtomicInteger();
|
||||
|
||||
/**
|
||||
* Factory, used to create new entity instances with the given name
|
||||
*/
|
||||
/** Factory, used to create new entity instances with the given name */
|
||||
private final Function<String, E> factory;
|
||||
|
||||
/**
|
||||
* The tested data access object
|
||||
*/
|
||||
/** The tested data access object */
|
||||
private final D dao;
|
||||
|
||||
/**
|
||||
* Create a new test using the given factory and dao
|
||||
*
|
||||
* @param factory The factory, used to create new entity instances with the given name
|
||||
* @param dao The tested data access object
|
||||
* @param dao The tested data access object
|
||||
*/
|
||||
public BaseDaoTest(final Function<String, E> factory, final D dao) {
|
||||
this.factory = factory;
|
||||
@@ -141,5 +133,4 @@ public abstract class BaseDaoTest<E extends BaseEntity, D extends DaoBaseImpl<E>
|
||||
assertEquals(expectedName, entity.getName());
|
||||
assertEquals(expectedName, entity.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-16
@@ -41,10 +41,7 @@ import com.iluwatar.servicelayer.wizard.WizardDao;
|
||||
import java.util.Set;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* MagicServiceImplTest
|
||||
*
|
||||
*/
|
||||
/** MagicServiceImplTest */
|
||||
class MagicServiceImplTest {
|
||||
|
||||
@Test
|
||||
@@ -93,11 +90,7 @@ class MagicServiceImplTest {
|
||||
void testFindWizardsWithSpellbook() {
|
||||
final var bookname = "bookname";
|
||||
final var spellbook = mock(Spellbook.class);
|
||||
final var wizards = Set.of(
|
||||
mock(Wizard.class),
|
||||
mock(Wizard.class),
|
||||
mock(Wizard.class)
|
||||
);
|
||||
final var wizards = Set.of(mock(Wizard.class), mock(Wizard.class), mock(Wizard.class));
|
||||
when(spellbook.getWizards()).thenReturn(wizards);
|
||||
|
||||
final var spellbookDao = mock(SpellbookDao.class);
|
||||
@@ -106,7 +99,6 @@ class MagicServiceImplTest {
|
||||
final var wizardDao = mock(WizardDao.class);
|
||||
final var spellDao = mock(SpellDao.class);
|
||||
|
||||
|
||||
final var service = new MagicServiceImpl(wizardDao, spellbookDao, spellDao);
|
||||
verifyNoInteractions(wizardDao, spellbookDao, spellDao, spellbook);
|
||||
|
||||
@@ -122,11 +114,7 @@ class MagicServiceImplTest {
|
||||
|
||||
@Test
|
||||
void testFindWizardsWithSpell() {
|
||||
final var wizards = Set.of(
|
||||
mock(Wizard.class),
|
||||
mock(Wizard.class),
|
||||
mock(Wizard.class)
|
||||
);
|
||||
final var wizards = Set.of(mock(Wizard.class), mock(Wizard.class), mock(Wizard.class));
|
||||
final var spellbook = mock(Spellbook.class);
|
||||
when(spellbook.getWizards()).thenReturn(wizards);
|
||||
|
||||
@@ -152,5 +140,4 @@ class MagicServiceImplTest {
|
||||
|
||||
verifyNoMoreInteractions(wizardDao, spellbookDao, spellDao);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,10 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import com.iluwatar.servicelayer.common.BaseDaoTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* SpellDaoImplTest
|
||||
*
|
||||
*/
|
||||
/** SpellDaoImplTest */
|
||||
class SpellDaoImplTest extends BaseDaoTest<Spell, SpellDaoImpl> {
|
||||
|
||||
public SpellDaoImplTest() {
|
||||
@@ -51,5 +48,4 @@ class SpellDaoImplTest extends BaseDaoTest<Spell, SpellDaoImpl> {
|
||||
assertEquals(spell.getName(), spellByName.getName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-5
@@ -30,10 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import com.iluwatar.servicelayer.common.BaseDaoTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* SpellbookDaoImplTest
|
||||
*
|
||||
*/
|
||||
/** SpellbookDaoImplTest */
|
||||
class SpellbookDaoImplTest extends BaseDaoTest<Spellbook, SpellbookDaoImpl> {
|
||||
|
||||
public SpellbookDaoImplTest() {
|
||||
@@ -51,5 +48,4 @@ class SpellbookDaoImplTest extends BaseDaoTest<Spellbook, SpellbookDaoImpl> {
|
||||
assertEquals(book.getName(), spellByName.getName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,10 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import com.iluwatar.servicelayer.common.BaseDaoTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* WizardDaoImplTest
|
||||
*
|
||||
*/
|
||||
/** WizardDaoImplTest */
|
||||
class WizardDaoImplTest extends BaseDaoTest<Wizard, WizardDaoImpl> {
|
||||
|
||||
public WizardDaoImplTest() {
|
||||
@@ -51,5 +48,4 @@ class WizardDaoImplTest extends BaseDaoTest<Wizard, WizardDaoImpl> {
|
||||
assertEquals(spell.getName(), byName.getName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user