Newer
Older
import java.util.concurrent.TimeUnit;
public class TestModel {
//needs a fresh or empty database to run tests
public static void main(String[] args) {
Model testModel = new Model("localhost", 8989);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException exception) {
System.out.println("Sleep");
}
//test underlying database methods
//add first employee
System.out.println("New Model\nemployees size: " + testModel.employeeSize());
testModel.printAllEmployees();
testModel.addEmployee("Alex", "Abend");
System.out.println("Employee Alex Abend added.\nPrinting all employees:");
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException exception) {
System.out.println("Sleep");
}
testModel.printAllEmployees();
System.out.println("Removing Alex");
testModel.removeEmployee("1");
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException exception) {
System.out.println("Sleep");
}
System.out.println("employees size: " + testModel.employeeSize());
Rafi Zereselasie (raz070)
committed
// Make the schedule (Add shifts) Rafi's Test Suite
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
System.out.println();
System.out.println("Making the schedule (Add shifts) Test Suite:\nAdding Freya and Mike as employees.");
testModel.addEmployee("Freya", "Fulltime");
testModel.addEmployee("Mike", "Parttime");
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException exception) {
System.out.println("Sleep");
}
System.out.println();
System.out.println("Adding a shift for Freya from 9-5 on March-03-2022.");
testModel.addShift(2, "2022-03-13", 900, 1700);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException exception) {
System.out.println("Sleep");
}
System.out.println("Expected output: [allShifts, 2.2022-03-13.900.1700.1] ");
System.out.println("Actual output: ...");
testModel.printAllShifts();
System.out.println();
System.out.println("Adding a shift for Mike from 5-9 on March-03-2022.");
testModel.addShift(3, "2022-03-13", 1700, 2100);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException exception) {
System.out.println("Sleep");
}
System.out.println("Expected output: [allShifts, 2.2022-03-13.900.1700.1, 3.2022-03-13.1700.2100.2] ");
System.out.println("Actual output: ...");
testModel.printAllShifts();
Rafi Zereselasie (raz070)
committed
System.out.println();
System.out.println("Adding the same shift for Mike from 5-9 on March-03-2022.");
testModel.addShift(3, "2022-03-13", 1700, 2100);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException exception) {
System.out.println("Sleep");
}
System.out.println("Expected output: [allShifts, 2.2022-03-13.900.1700.1, 3.2022-03-13.1700.2100.2] ");
System.out.println("Actual output: ...");
testModel.printAllShifts();
testModel.removeEmployee("2");
testModel.removeEmployee("3");
// End the program
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException exception) {
System.out.println("Sleep");
}
testModel.logOut();