mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-05-13 17:11:49 +00:00
test(DevWeb): Add tests in Game_JPA_DAO_FactoryTest
This commit is contained in:
@@ -1,32 +1,77 @@
|
|||||||
package uppa.project.dao.jpa;
|
package uppa.project.dao.jpa;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import uppa.project.dao.DAO;
|
||||||
|
import uppa.project.dao.DAOException;
|
||||||
|
import uppa.project.pojo.User;
|
||||||
|
import uppa.project.provider.EntityManagerProvider;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
class Game_JPA_DAO_FactoryTest {
|
class Game_JPA_DAO_FactoryTest {
|
||||||
|
|
||||||
@Test
|
static Game_JPA_DAO_Factory factory;
|
||||||
void getDAOUser() {
|
|
||||||
// TODO Implement this method
|
@BeforeAll
|
||||||
fail();
|
static void setUp() {
|
||||||
|
EntityManagerProvider.setPersitenceUnitName("test");
|
||||||
|
factory = new Game_JPA_DAO_Factory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getDAOGame() {
|
void test_getDAOUser() throws DAOException {
|
||||||
// TODO Implement this method
|
// If the method throws an exception, make sure the database is running
|
||||||
fail();
|
assertDoesNotThrow(() -> factory.getDAOUser());
|
||||||
|
|
||||||
|
// Check if the returned object is a DAO<User>
|
||||||
|
assertNotNull(factory.getDAOUser());
|
||||||
|
|
||||||
|
// Check if the object is unique
|
||||||
|
DAO<User> dao1 = factory.getDAOUser();
|
||||||
|
DAO<User> dao2 = factory.getDAOUser();
|
||||||
|
assertEquals(dao1, dao2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getDAOPlayer() {
|
void test_getDAOGame() throws DAOException {
|
||||||
// TODO Implement this method
|
// If the method throws an exception, make sure the database is running
|
||||||
fail();
|
assertDoesNotThrow(() -> factory.getDAOGame());
|
||||||
|
|
||||||
|
// Check if the returned object is a DAO<Game>
|
||||||
|
assertNotNull(factory.getDAOGame());
|
||||||
|
|
||||||
|
// Check if the object is unique
|
||||||
|
DAO<User> dao1 = factory.getDAOUser();
|
||||||
|
DAO<User> dao2 = factory.getDAOUser();
|
||||||
|
assertEquals(dao1, dao2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getDAORecoveryPasswordToken() {
|
void test_getDAOPlayer() throws DAOException {
|
||||||
// TODO Implement this method
|
// If the method throws an exception, make sure the database is running
|
||||||
fail();
|
assertDoesNotThrow(() -> factory.getDAOPlayer());
|
||||||
|
|
||||||
|
// Check if the returned object is a DAO<Player>
|
||||||
|
assertNotNull(factory.getDAOPlayer());
|
||||||
|
|
||||||
|
// Check if the object is unique
|
||||||
|
DAO<User> dao1 = factory.getDAOUser();
|
||||||
|
DAO<User> dao2 = factory.getDAOUser();
|
||||||
|
assertEquals(dao1, dao2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test_getDAORecoveryPasswordToken() throws DAOException {
|
||||||
|
// If the method throws an exception, make sure the database is running
|
||||||
|
assertDoesNotThrow(() -> factory.getDAORecoveryPasswordToken());
|
||||||
|
|
||||||
|
// Check if the returned object is a DAO<RecoveryPasswordToken>
|
||||||
|
assertNotNull(factory.getDAORecoveryPasswordToken());
|
||||||
|
|
||||||
|
// Check if the object is unique
|
||||||
|
DAO<User> dao1 = factory.getDAOUser();
|
||||||
|
DAO<User> dao2 = factory.getDAOUser();
|
||||||
|
assertEquals(dao1, dao2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user