Skip to content
Snippets Groups Projects
Commit 64bb208e authored by Matthew Williams's avatar Matthew Williams
Browse files

Merge branch 'UC92v2' of https://gitlab.engr.illinois.edu/htmoss2/cs427fa20team22 into UC92v2

parents 73bc4dbd 892553bf
No related branches found
No related tags found
1 merge request!16Remove unnecessary imports, standardize others
package edu.ncsu.csc.itrust.unit.dao.patient;
import junit.framework.TestCase;
import edu.ncsu.csc.itrust.dao.mysql.PatientDAO;
import edu.ncsu.csc.itrust.unit.datagenerators.TestDataGenerator;
import edu.ncsu.csc.itrust.unit.testutils.TestDAOFactory;
public class DeactivatePatientTest extends TestCase {
private TestDataGenerator gen = new TestDataGenerator();
private PatientDAO patientDAO = TestDAOFactory.getTestInstance().getPatientDAO();
@Override
protected void setUp() throws Exception {
gen.clearAllTables();
gen.patient92();
gen.patient4();
}
public void testDeactivateActivatedPatient() throws Exception {
long pid = 4;
assertEquals("patient", patientDAO.getRole(pid));
patientDAO.deactivatePatient(pid);
assertEquals("deactivatedPatient", patientDAO.getRole(pid));
}
public void testDeactivatePreregisteredPatient() throws Exception {
long pid = 92;
assertEquals("preRegisteredPatient", patientDAO.getRole(pid));
patientDAO.deactivatePatient(pid);
assertEquals("deactivatedPatient", patientDAO.getRole(pid));
}
public void testDeactivateThenActivatePatient() throws Exception {
long pid = 92;
assertEquals("preRegisteredPatient", patientDAO.getRole(pid));
patientDAO.ConvertPreRegisteredPatientsToPatient(pid);
assertEquals("patient", patientDAO.getRole(pid));
patientDAO.deactivatePatient(pid);
assertEquals("deactivatedPatient", patientDAO.getRole(pid));
}
}
package edu.ncsu.csc.itrust.unit.dao.patient;
import junit.framework.TestCase;
import edu.ncsu.csc.itrust.dao.mysql.PatientDAO;
import edu.ncsu.csc.itrust.unit.datagenerators.TestDataGenerator;
import edu.ncsu.csc.itrust.unit.testutils.TestDAOFactory;
public class GetRoleTest extends TestCase {
private PatientDAO patientDAO = TestDAOFactory.getTestInstance().getPatientDAO();
private TestDataGenerator gen;
@Override
protected void setUp() throws Exception {
gen = new TestDataGenerator();
gen.clearAllTables();
gen.patient92();
gen.patient4();
gen.patient21();
}
public void testGetRole() throws Exception {
String role = patientDAO.getRole(92);
assertEquals("preRegisteredPatient", role);
}
public void testAnotherRole() throws Exception {
String role = patientDAO.getRole(4);
assertEquals("patient", role);
}
public void testNotRole() throws Exception {
String role = patientDAO.getRole(21);
assertEquals("patient", role);
}
public void testNonExistent() throws Exception {
try {
String role = patientDAO.getRole(9999999);
fail("This shouldn't ever be reached");
} catch (Exception e) {
assertEquals("User does not exist with the designated role", e.getMessage());
}
}
}
......@@ -690,6 +690,10 @@ public class TestDataGenerator {
new DBBuilder(factory).executeSQLFile(DIR + "/patient42.sql");
}
public void patient92() throws FileNotFoundException, SQLException, IOException {
new DBBuilder(factory).executeSQLFile(DIR + "/patient92.sql");
}
/**
* Adds patient Anakin Skywalker for UC10 and UC37 testing purposes.
*
......@@ -781,12 +785,12 @@ public class TestDataGenerator {
public void hcp_diagnosis_data() throws FileNotFoundException, IOException,
SQLException {
new DBBuilder(factory).executeSQLFile(DIR + "/hcp_diagnosis_data.sql");
}
public void hcp_additional_diagnosis_data() throws FileNotFoundException,
IOException, SQLException {
new DBBuilder(factory).executeSQLFile(DIR + "/hcp_additional_diagnosis_data.sql");
}
}
public void hcp_additional_diagnosis_data() throws FileNotFoundException,
IOException, SQLException {
new DBBuilder(factory).executeSQLFile(DIR + "/hcp_additional_diagnosis_data.sql");
}
public void immunization_data() throws FileNotFoundException, IOException,
SQLException {
......@@ -953,14 +957,14 @@ public class TestDataGenerator {
public void malaria_epidemic1() throws SQLException, FileNotFoundException,
IOException {
new DBBuilder(factory).executeSQLFile(DIR + "/malariaEpidemic1.sql");
}
public void malaria_epidemic2() throws SQLException, FileNotFoundException,
}
public void malaria_epidemic2() throws SQLException, FileNotFoundException,
IOException {
new DBBuilder(factory).executeSQLFile(DIR + "/malariaEpidemic2.sql");
}
public void malaria_epidemic3() throws SQLException, FileNotFoundException,
}
public void malaria_epidemic3() throws SQLException, FileNotFoundException,
IOException {
new DBBuilder(factory).executeSQLFile(DIR + "/malariaEpidemic3.sql");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment