diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 5b6a736..25f0e83 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,12 +4,36 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
@@ -85,15 +109,63 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -102,15 +174,34 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
@@ -138,112 +229,7 @@
-
-
-
- 1681681890907
-
-
-
- 1681681890907
-
-
- 1681681917750
-
-
-
- 1681681917750
-
-
- 1681685399106
-
-
-
- 1681685399107
-
-
- 1681685426481
-
-
-
- 1681685426481
-
-
- 1681685473011
-
-
-
- 1681685473011
-
-
- 1681685535046
-
-
-
- 1681685535046
-
-
- 1681685556766
-
-
-
- 1681685556766
-
-
- 1681685571208
-
-
-
- 1681685571208
-
-
- 1681685589119
-
-
-
- 1681685589119
-
-
- 1681685619528
-
-
-
- 1681685619528
-
-
- 1681685641546
-
-
-
- 1681685641546
-
-
- 1681697782990
-
-
-
- 1681697782990
-
-
- 1681697824548
-
-
-
- 1681697824548
-
-
- 1681697845597
-
-
-
- 1681697845597
-
-
- 1681697864324
-
-
-
- 1681697864324
+
1681697893913
@@ -483,25 +469,118 @@
1681743277604
-
+
+ 1681749492225
+
+
+
+ 1681749492226
+
+
+ 1681749509386
+
+
+
+ 1681749509386
+
+
+ 1681749525323
+
+
+
+ 1681749525323
+
+
+ 1681749542652
+
+
+
+ 1681749542652
+
+
+ 1681749565363
+
+
+
+ 1681749565363
+
+
+ 1681750672845
+
+
+
+ 1681750672845
+
+
+ 1681750706807
+
+
+
+ 1681750706807
+
+
+ 1681763308430
+
+
+
+ 1681763308431
+
+
+ 1681763347655
+
+
+
+ 1681763347655
+
+
+ 1681763367177
+
+
+
+ 1681763367177
+
+
+ 1681763396822
+
+
+
+ 1681763396822
+
+
+ 1681763426387
+
+
+
+ 1681763426387
+
+
+ 1681763448148
+
+
+
+ 1681763448148
+
+
+ 1681763468653
+
+
+
+ 1681763468653
+
+
+ 1681764914426
+
+
+
+ 1681764914426
+
+
-
-
-
-
-
-
-
-
-
-
-
-
@@ -513,8 +592,25 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ com.example.exa863_management_system_2023.model.*
+
\ No newline at end of file
diff --git a/src/main/java/com/example/exa863_management_system_2023/dao/building/BuildingListImplementation.java b/src/main/java/com/example/exa863_management_system_2023/dao/building/BuildingListImplementation.java
index 11110bc..849954f 100644
--- a/src/main/java/com/example/exa863_management_system_2023/dao/building/BuildingListImplementation.java
+++ b/src/main/java/com/example/exa863_management_system_2023/dao/building/BuildingListImplementation.java
@@ -51,7 +51,6 @@ public void update(Building building) throws Exception {
for (int i = 0; i < this.listOfBuilding.size(); i++) {
if (this.listOfBuilding.get(i).getID().equals(building.getID())) {
this.listOfBuilding.set(i, building);
- return;
}
}
}
diff --git a/src/main/java/com/example/exa863_management_system_2023/model/Building.java b/src/main/java/com/example/exa863_management_system_2023/model/Building.java
index e417057..49ac22a 100644
--- a/src/main/java/com/example/exa863_management_system_2023/model/Building.java
+++ b/src/main/java/com/example/exa863_management_system_2023/model/Building.java
@@ -7,45 +7,71 @@ public class Building extends Service{
private List usedComponents;
+ /**
+ *
+ * @param name Name of the Building
+ * @param description Description of the Building
+ * @param price Price of the Building
+ * @param cost Cost of the Building
+ */
public Building(String name, String description, long price, long cost) {
super(name, description, price, cost);
this.usedComponents = new ArrayList<>();
}
+ /**
+ *
+ * @return Return Building's used components
+ */
public List getUsedComponents() {
return usedComponents;
}
+
+ /**
+ *
+ * @param usedComponents new value to used components
+ */
public void setUsedComponents(List usedComponents) {
this.usedComponents = usedComponents;
}
+ /**
+ * Add a new component to the component list
+ * @param component New component
+ */
public void addComputerComponent(ComputerComponent component) {
this.usedComponents.add(component);
}
- @Override
- public long getPrice() {
+ /**
+ * Add the price of the used components to the subtotal
+ * @return Return the price that was fixed to the Building plus the additional price of the components
+ */
+ public long increasePrice() {
long price = 0;
for (ComputerComponent component : this.usedComponents) {
price += component.getUnitPrice() * component.getQuantity();
}
- return price;
+ return price + this.getPrice();
}
- @Override
- public long getCost() {
+ /**
+ * Add the cost of the used components to the subtotal
+ * @return Return the cost that was fixed to the Building plus the additional cost of the components
+ */
+ public long increaseCost() {
long cost = 0;
for (ComputerComponent component : this.usedComponents) {
cost += component.getUnitCost() * component.getQuantity();
}
- return cost;
- }
-
- public void addUsedComponent(ComputerComponent component, int quantity) {
- component.setQuantity(component.getQuantity() - quantity);
- this.usedComponents.add(component);
+ return cost + this.getCost();
}
+ /**
+ *
+ * @param object Receive a random object
+ * @return Return true if the given object is equal to the current Building object, or false if they are not the same
+ */
@Override
public boolean equals(Object object) {
if (object instanceof Building) {
@@ -57,6 +83,10 @@ public boolean equals(Object object) {
return false;
}
+ /**
+ *
+ * @return Return a short formatted description of the object
+ */
@Override
public String toString() {
return super.toString() + ", Service: Building" + ", Components: " + this.usedComponents;
diff --git a/src/main/java/com/example/exa863_management_system_2023/model/Cleaning.java b/src/main/java/com/example/exa863_management_system_2023/model/Cleaning.java
index 9d2c5a0..de5b102 100644
--- a/src/main/java/com/example/exa863_management_system_2023/model/Cleaning.java
+++ b/src/main/java/com/example/exa863_management_system_2023/model/Cleaning.java
@@ -7,22 +7,47 @@ public class Cleaning extends Service{
private List components;
+ /**
+ *
+ * @param name Name of the Cleaning
+ * @param description Description of the Cleaning
+ * @param price Price of the Cleaning
+ * @param cost Cost og the Cleaning
+ */
public Cleaning(String name, String description, long price, long cost) {
super(name, description, price, cost);
this.components = new ArrayList<>();
}
+ /**
+ *
+ * @return Return Cleaning's component list
+ */
public List getComponents() {
return components;
}
+
+ /**
+ *
+ * @param components New value to component list
+ */
public void setComponents(List components) {
this.components = components;
}
+ /**
+ * Add a new component to the component list
+ * @param component New component
+ */
public void addComponent(ComputerComponent component) {
this.components.add(component);
}
+ /**
+ *
+ * @param object Receive a random object
+ * @return Return true if the given object is equal to the current Cleaning object, or false if they are not the same
+ */
@Override
public boolean equals(Object object) {
if (object instanceof Cleaning) {
@@ -34,6 +59,10 @@ public boolean equals(Object object) {
return false;
}
+ /**
+ *
+ * @return Return a short formatted description of the object
+ */
@Override
public String toString() {
return super.toString() + ", Service: Cleaning" + ", Components: " + this.components;
diff --git a/src/main/java/com/example/exa863_management_system_2023/model/Client.java b/src/main/java/com/example/exa863_management_system_2023/model/Client.java
index e8389da..1080fbe 100644
--- a/src/main/java/com/example/exa863_management_system_2023/model/Client.java
+++ b/src/main/java/com/example/exa863_management_system_2023/model/Client.java
@@ -8,26 +8,56 @@ public class Client extends Person {
private String phone;
private List workOrderList;
+ /**
+ *
+ * @param name Name of the Person
+ * @param email Email of the Person
+ * @param address Address of the Person
+ * @param phone Phone of the Person
+ */
public Client(String name, String email, String address, String phone) {
super(name, email);
this.address = address;
this.phone = phone;
}
+ /**
+ *
+ * @return Return Client's address
+ */
public String getAddress() {
return address;
}
+
+ /**
+ *
+ * @param address New value to address
+ */
public void setAddress(String address) {
this.address = address;
}
+ /**
+ *
+ * @return Return Client's phone
+ */
public String getPhone() {
return phone;
}
+
+ /**
+ *
+ * @param phone New value to phone
+ */
public void setPhone(String phone) {
this.phone = phone;
}
+ /**
+ *
+ * @param object Receive a random object;
+ * @return Return true if the given object is equal to the current Client object, or false if they are not the same
+ */
@Override
public boolean equals(Object object) {
if (object instanceof Client) {
@@ -39,6 +69,10 @@ public boolean equals(Object object) {
return false;
}
+ /**
+ *
+ * @return Return a short formatted description of the object
+ */
@Override
public String toString() {
return super.toString() + ", Address: " + this.address + ", Phone: " + this.phone;
diff --git a/src/main/java/com/example/exa863_management_system_2023/model/ComputerComponent.java b/src/main/java/com/example/exa863_management_system_2023/model/ComputerComponent.java
index 39ddb9d..02dc03b 100644
--- a/src/main/java/com/example/exa863_management_system_2023/model/ComputerComponent.java
+++ b/src/main/java/com/example/exa863_management_system_2023/model/ComputerComponent.java
@@ -13,6 +13,16 @@ public class ComputerComponent {
private long unitPrice;
private int quantity;
+ /**
+ *
+ * @param name Name of the Component
+ * @param description Description of the Component
+ * @param manufacturer Manufacturer of the Component
+ * @param serialNumber Serial number of the Component
+ * @param unitCost Unit cost of the Component
+ * @param unitPrice Unit price of the Component
+ * @param quantity Quantity of the Component
+ */
public ComputerComponent(String name, String description, String manufacturer, String serialNumber, long unitCost, long unitPrice, int quantity) {
this.name = name;
this.description = description;
@@ -23,75 +33,167 @@ public ComputerComponent(String name, String description, String manufacturer, S
this.quantity = quantity;
}
+ /**
+ *
+ * @param name Name of the Component
+ * @param description Description of the Component
+ * @param manufacturer Manufacturer of the Component
+ */
public ComputerComponent(String name, String description, String manufacturer) {
this.name = name;
this.description = description;
this.manufacturer = manufacturer;
}
+ /**
+ *
+ * @return Return Component's name
+ */
public String getName() {
return name;
}
- public void setName() {
+
+ /**
+ *
+ * @param name New value to name
+ */
+ public void setName(String name) {
this.name = name;
}
+ /**
+ *
+ * @return Return Component's ID
+ */
public String getID() {
return id;
}
+
+ /**
+ *
+ * @param id New value to ID
+ */
public void setID(String id) {
this.id = id;
}
+ /**
+ *
+ * @return Return Component's description
+ */
public String getDescription() {
return description;
}
+
+ /**
+ *
+ * @param description New value to description
+ */
public void setDescription(String description) {
this.description = description;
}
+
+ /**
+ *
+ * @return Return Component's manufacturer
+ */
public String getManufacturer() {
return manufacturer;
}
+
+ /**
+ *
+ * @param manufacturer New value to manufacturer
+ */
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
+ /**
+ *
+ * @return Return Component's serial number
+ */
public String getSerialNumber() {
return serialNumber;
}
+
+ /**
+ *
+ * @param serialNumber New value to serial number
+ */
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
+ /**
+ *
+ * @return Return Component's unit cost
+ */
public long getUnitCost() {
return unitCost;
}
+
+ /**
+ *
+ * @param unitCost New value to unit cost
+ */
public void setUnitCost(long unitCost) {
this.unitCost = unitCost;
}
+ /**
+ *
+ * @return Return Component's unit price
+ */
public long getUnitPrice() {
return unitPrice;
}
- public void setPrice(long unitPrice) {
+
+ /**
+ *
+ * @param unitPrice New value to unit price
+ */
+ public void setUnitPrice(long unitPrice) {
this.unitPrice = unitPrice;
}
+ /**
+ *
+ * @return Return Component's quantity
+ */
public int getQuantity() {
return quantity;
}
+
+ /**
+ *
+ * @param quantity New value to quantity
+ */
public void setQuantity(int quantity) {
this.quantity = quantity;}
+ /**
+ *
+ * @return Return the result of the multiplication between the unit cost and the quantity
+ */
public long getCost() {
return this.getUnitCost() * this.getQuantity();
}
+ /**
+ *
+ * @return Return the result of the multiplication between the unit price and the quantity
+ */
public long getPrice() {
return this.getUnitPrice() * this.getQuantity();
}
+ /**
+ *
+ * @param object Receive a random object
+ * @return Return true if the given object is equal to the current Manager object, or false if they are not the same
+ */
@Override
public boolean equals(Object object) {
if(object instanceof ComputerComponent) {
@@ -102,8 +204,13 @@ public boolean equals(Object object) {
}
return false;
}
+
+ /**
+ *
+ * @return Return a short formatted description of the object
+ */
@Override
public String toString() {
- return "ID: " + this.id + ", Description: " + this.description + ", Manufacturer: " + this.manufacturer + ", Serial Number: " + this.serialNumber + ", Unit Cost: " + this.unitCost + ", Unit Price: " + this.unitPrice + ", Quantity: " + this.quantity;
+ return "ID: " + this.id + ", Name: " + this.name + ", Description: " + this.description + ", Manufacturer: " + this.manufacturer + ", Serial Number: " + this.serialNumber + ", Unit Cost: " + this.unitCost + ", Unit Price: " + this.unitPrice + ", Quantity: " + this.quantity;
}
}
diff --git a/src/main/java/com/example/exa863_management_system_2023/model/Employee.java b/src/main/java/com/example/exa863_management_system_2023/model/Employee.java
index 68203b2..0143826 100644
--- a/src/main/java/com/example/exa863_management_system_2023/model/Employee.java
+++ b/src/main/java/com/example/exa863_management_system_2023/model/Employee.java
@@ -2,10 +2,22 @@
public class Employee extends User {
+ /**
+ *
+ * @param name Name of the Employee
+ * @param email Email of the Employee
+ * @param login Login of the Employee
+ * @param password Password of the Employee
+ */
public Employee(String name, String email, String login, String password) {
super(name, email, login, password);
}
+ /**
+ *
+ * @param object Receive a random object
+ * @return Return true if the given object is equal to the current Employee object, or false if they are not the same
+ */
@Override
public boolean equals(Object object) {
if (object instanceof Employee) {
@@ -17,6 +29,10 @@ public boolean equals(Object object) {
return false;
}
+ /**
+ *
+ * @return Return a short formatted description of the object
+ */
@Override
public String toString() {
return super.toString() + ", Role: Employee";
diff --git a/src/main/java/com/example/exa863_management_system_2023/model/Installation.java b/src/main/java/com/example/exa863_management_system_2023/model/Installation.java
index 74cc487..eed0f1a 100644
--- a/src/main/java/com/example/exa863_management_system_2023/model/Installation.java
+++ b/src/main/java/com/example/exa863_management_system_2023/model/Installation.java
@@ -8,30 +8,65 @@ public class Installation extends Service {
private List programs;
private String operatingSystem;
+ /**
+ *
+ * @param name Name of the Installation
+ * @param description Description of the Installation
+ * @param price Price of the Installation
+ * @param cost Cost of the Installation
+ * @param operatingSystem Operating system of the Installation
+ */
public Installation(String name, String description, long price, long cost, String operatingSystem) {
super(name, description, price, cost);
this.programs = new ArrayList<>();
this.operatingSystem = operatingSystem;
}
+ /**
+ *
+ * @return Return Installation's programs
+ */
public List getPrograms() {
return programs;
}
+
+ /**
+ *
+ * @param programs new value to programs
+ */
public void setPrograms(List programs) {
this.programs = programs;
}
+ /**
+ *
+ * @return Return Installation's operating system
+ */
public String getOperatingSystem() {
return operatingSystem;
}
+
+ /**
+ *
+ * @param operatingSystem New value to operating System
+ */
public void setOperatingSystem(String operatingSystem) {
this.operatingSystem = operatingSystem;
}
+ /**
+ * Add a new program to the program list
+ * @param program New program
+ */
public void addProgram(String program) {
this.programs.add(program);
}
+ /**
+ *
+ * @param object Receive a random object
+ * @return Return true if the given object is equal to the current Manager object, or false if they are not the same
+ */
@Override
public boolean equals(Object object) {
if (object instanceof Installation) {
@@ -43,9 +78,12 @@ public boolean equals(Object object) {
return false;
}
+ /**
+ *
+ * @return Return a short formatted description of the object
+ */
@Override
public String toString() {
return super.toString() + ", Service: Installation" + ", Programs: " + this.programs + ", Operating System: " + this.operatingSystem;
-
}
}
diff --git a/src/main/java/com/example/exa863_management_system_2023/model/Manager.java b/src/main/java/com/example/exa863_management_system_2023/model/Manager.java
index e57349e..4ef9812 100644
--- a/src/main/java/com/example/exa863_management_system_2023/model/Manager.java
+++ b/src/main/java/com/example/exa863_management_system_2023/model/Manager.java
@@ -2,10 +2,22 @@
public class Manager extends User{
+ /**
+ *
+ * @param name Name of the Manager
+ * @param email Email of the Manager
+ * @param login Login of the Manager
+ * @param password Password of the Manager
+ */
public Manager(String name, String email, String login, String password) {
super(name, email, login, password);
}
+ /**
+ *
+ * @param object Receive a random object
+ * @return Return true if the given object is equal to the current Manager object, or false if they are not the same
+ */
@Override
public boolean equals(Object object) {
if (object instanceof Manager) {
@@ -17,6 +29,10 @@ public boolean equals(Object object) {
return false;
}
+ /**
+ *
+ * @return Return a short formatted description of the object
+ */
@Override
public String toString() {
return super.toString() + ", Role: Manager";
diff --git a/src/main/java/com/example/exa863_management_system_2023/model/Person.java b/src/main/java/com/example/exa863_management_system_2023/model/Person.java
index f9d2d3a..4701ff8 100644
--- a/src/main/java/com/example/exa863_management_system_2023/model/Person.java
+++ b/src/main/java/com/example/exa863_management_system_2023/model/Person.java
@@ -6,32 +6,68 @@ public abstract class Person {
private String name;
private String email;
+ /**
+ *
+ * @param name Name of the Person
+ * @param email Email of the Person
+ */
public Person(String name, String email) {
this.name = name;
this.email =email;
}
+ /**
+ *
+ * @return Return the Person's ID
+ */
public String getID() {
return id;
}
+
+ /**
+ *
+ * @param id New value to ID
+ */
public void setID(String id) {
this.id = id;
}
+ /**
+ *
+ * @return Return the Person's name
+ */
public String getName() {
return name;
}
+
+ /**
+ *
+ * @param name New value to name
+ */
public void setName(String name) {
this.name = name;
}
+ /**
+ *
+ * @return Return the Person's email
+ */
public String getEmail() {
return email;
}
+
+ /**
+ *
+ * @param email New value to email
+ */
public void setEmail(String email) {
this.email = email;
}
+ /**
+ *
+ * @return Return a short formatted description of the object
+ */
@Override
public String toString() {
return "ID: " + this.id + ", Name: " + this.name + ", Email: " + this.email;
diff --git a/src/main/java/com/example/exa863_management_system_2023/model/Service.java b/src/main/java/com/example/exa863_management_system_2023/model/Service.java
index 77bf9aa..1c30cf7 100644
--- a/src/main/java/com/example/exa863_management_system_2023/model/Service.java
+++ b/src/main/java/com/example/exa863_management_system_2023/model/Service.java
@@ -8,6 +8,13 @@ public abstract class Service {
private long price;
private long cost;
+ /**
+ *
+ * @param name Name of the Service
+ * @param description Description of the Service
+ * @param price Price of the Service
+ * @param cost Cost of the Service
+ */
public Service(String name, String description, long price, long cost) {
this.name = name;
this.description = description;
@@ -15,44 +22,98 @@ public Service(String name, String description, long price, long cost) {
this.cost = cost;
}
+ /**
+ *
+ * @param name Name of the Service
+ * @param description Description of the Service
+ */
public Service(String name, String description) {
this.name = name;
this.description = description;
}
+ /**
+ *
+ * @return Return Service's ID
+ */
public String getID() { return id;}
+
+ /**
+ *
+ * @param id New value to ID
+ */
public void setID(String id) {
this.id = id;
}
+ /**
+ *
+ * @return Return Service's name
+ */
public String getName() {
return name;
}
+
+ /**
+ *
+ * @param name New value to name
+ */
public void setName(String name) {
this.name = name;
}
+ /**
+ *
+ * @return Return Service's description
+ */
public String getDescription() {
return description;
}
+
+ /**
+ *
+ * @param description New value to description
+ */
public void setDescription(String description) {
this.description = description;
}
+ /**
+ *
+ * @return Return Service's price
+ */
public long getPrice() {
return price;
}
+
+ /**
+ *
+ * @param price New value to price
+ */
public void setPrice(long price) {
this.price = price;
}
+ /**
+ *
+ * @return Return Service's cost
+ */
public long getCost() {
return cost;
}
+
+ /**
+ *
+ * @param cost New value to cost
+ */
public void setCost(long cost) {
this.cost = cost;
}
+ /**
+ *
+ * @return Return a short formatted description of the object
+ */
@Override
public String toString() {
return "ID: " + this.id + ", Name: " + this.name + ", Description: " + this.description + ", Price: " + this.price + ", Cost: " + this.cost;
diff --git a/src/main/java/com/example/exa863_management_system_2023/model/Technician.java b/src/main/java/com/example/exa863_management_system_2023/model/Technician.java
index f02ed39..06f9c06 100644
--- a/src/main/java/com/example/exa863_management_system_2023/model/Technician.java
+++ b/src/main/java/com/example/exa863_management_system_2023/model/Technician.java
@@ -2,10 +2,22 @@
public class Technician extends User {
+ /**
+ *
+ * @param name Name of the Technician
+ * @param email Email of the Technician
+ * @param login Login of the Technician
+ * @param password Password of the Technician
+ */
public Technician(String name, String email, String login, String password) {
super(name, email, login, password);
}
+ /**
+ *
+ * @param object Receive a random object
+ * @return Return true if the given object is equal to the current Technician object, or false if they are not the same
+ */
@Override
public boolean equals(Object object) {
if (object instanceof Technician) {
@@ -17,8 +29,12 @@ public boolean equals(Object object) {
return false;
}
+ /**
+ *
+ * @return Return a short formatted description of the object
+ */
@Override
public String toString() {
- return super.toString() + " Role: Technician";
+ return super.toString() + ", Role: Technician";
}
}
diff --git a/src/main/java/com/example/exa863_management_system_2023/model/User.java b/src/main/java/com/example/exa863_management_system_2023/model/User.java
index b3be8a9..7a120ab 100644
--- a/src/main/java/com/example/exa863_management_system_2023/model/User.java
+++ b/src/main/java/com/example/exa863_management_system_2023/model/User.java
@@ -5,26 +5,55 @@ public abstract class User extends Person {
private String login;
private String password;
+ /**
+ *
+ * @param name Name of the User
+ * @param email Email of the User
+ * @param login Login of the User
+ * @param password Password of the User
+ */
public User(String name, String email, String login, String password) {
super(name, email);
this.login = login;
this.password = password;
}
+ /**
+ *
+ * @return Return the User's login
+ */
public String getLogin() {
return login;
}
+
+ /**
+ *
+ * @param login New value to login
+ */
public void setLogin(String login) {
this.login = login;
}
+ /**
+ *
+ * @return Return the User's password
+ */
public String getPassword() {
return password;
}
+
+ /**
+ *
+ * @param password New value to password
+ */
public void setPassword(String password) {
this.password = password;
}
+ /**
+ *
+ * @return Return a short formatted description of the object
+ */
@Override
public String toString() {
return super.toString() + ", Login: " + this.login + ", Password: " + this.password;
diff --git a/src/main/java/com/example/exa863_management_system_2023/model/WorkOrder.java b/src/main/java/com/example/exa863_management_system_2023/model/WorkOrder.java
index c77da43..a969e3a 100644
--- a/src/main/java/com/example/exa863_management_system_2023/model/WorkOrder.java
+++ b/src/main/java/com/example/exa863_management_system_2023/model/WorkOrder.java
@@ -23,115 +23,245 @@ public class WorkOrder {
private int clientSatisfaction;
private String paymentMethod;
+ /**
+ *
+ * @param clientID Client ID of the WorkOrder
+ * @param description Description of the WorkOrder
+ */
public WorkOrder(String clientID, String description) {
this.clientID = clientID;
this.technicianID = null;
this.status = "This work order is still active";
this.buildingList = new ArrayList<>();
this.cleaningList = new ArrayList<>();
- this.buildingList = new ArrayList<>();
+ this.installationList = new ArrayList<>();
this.description = description;
this.createdAt = new Date();
this.clientSatisfaction = 0;
this.paymentMethod = null;
}
+ /**
+ *
+ * @return Return WorkOrder's ID
+ */
public String getID() {
return id;
}
+
+ /**
+ *
+ * @param id New value to ID
+ */
public void setID(String id) {
this.id = id;
}
+ /**
+ *
+ * @return Return WorkOrder's client ID
+ */
public String getClientID() {
return clientID;
}
+
+ /**
+ *
+ * @param clientID New value to client ID
+ */
public void setClientID(String clientID) {
this.clientID = clientID;
}
+ /**
+ *
+ * @return Return WorkOrder's technician ID
+ */
public String getTechnicianID() {
return technicianID;
}
+
+ /**
+ *
+ * @param technicianID New value to technician ID
+ */
public void setTechnicianID(String technicianID) {
this.technicianID = technicianID;
}
+ /**
+ *
+ * @return Return WorkOrder's status
+ */
public String getStatus() {
return status;
}
+
+ /**
+ *
+ * @param status New value to status
+ */
public void setStatus(String status) {
this.status = status;
}
+ /**
+ *
+ * @return Return WorkOrder's building list
+ */
public List getBuildindList() {
return buildingList;
}
+
+ /**
+ *
+ * @param buildingList New value to building list
+ */
public void setBuildingList(List buildingList) {
this.buildingList = buildingList;
}
+
+ /**
+ *
+ * @return Return WorkOrder's cleaning list
+ */
public List getCleaningList() {
return cleaningList;
}
+
+ /**
+ *
+ * @param cleaningList New value to cleaning list
+ */
public void setCleaningList(List cleaningList) {
this.cleaningList = cleaningList;
}
+ /**
+ *
+ * @return Return WorkOrder's installation list
+ */
public List getInstallationList() {
return installationList;
}
+
+ /**
+ *
+ * @param installationList New value to installation list
+ */
public void setInstallationList(List installationList) {
this.installationList = installationList;
}
+ /**
+ *
+ * @return Return WorkOrder's description
+ */
public String getDescription() {
return description;
}
+
+ /**
+ *
+ * @param description New value to description
+ */
public void setDescription(String description) {
this.description = description;
}
+ /**
+ *
+ * @return Return WorkOrder's initial date
+ */
public Date getCreatedAt() {
return createdAt;
}
+
+ /**
+ *
+ * @param createdAt New value to initial date
+ */
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
+ /**
+ *
+ * @return Return WorkOrder's final date
+ */
public Date getFinishedAt() {
return finishedAt;
}
+
+ /**
+ *
+ * @param finishedAt New value to final date
+ */
public void setFinishedAt(Date finishedAt) {
this.finishedAt = finishedAt;
}
+ /**
+ *
+ * @return Return
+ */
public int getClientSatisfaction() {
return clientSatisfaction;
}
+
+ /**
+ *
+ * @param clientSatisfaction New value to client satisfaction
+ */
public void setClientSatisfaction(int clientSatisfaction) {
this.clientSatisfaction = clientSatisfaction;
}
+ /**
+ *
+ * @return Return WorkOrder's payment method
+ */
public String getPaymentMethod() {
return paymentMethod;
}
+
+ /**
+ *
+ * @param paymentMethod New value to payment method
+ */
public void setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
}
+ /**
+ * Add a new Building to the Building list
+ * @param building New Building
+ */
public void addBuildingService(Building building) {
this.buildingList.add(building);
}
+ /**
+ * Add a new Cleaning to the Cleaning list
+ * @param cleaning New Cleaning
+ */
public void addCleaningService(Cleaning cleaning) {
this.cleaningList.add(cleaning);
}
+ /**
+ * Add a new Installation to the installation list
+ * @param installation New Installation
+ */
public void addInstallationService(Installation installation) {
this.installationList.add(installation);
}
+ /**
+ * Get the price of all the Buildings
+ * @return Return the price of all the Buildings
+ */
public long getBuildingListPrice() {
long price = 0;
for(Building building : buildingList) {
@@ -140,6 +270,10 @@ public long getBuildingListPrice() {
return price;
}
+ /**
+ * Get the price of all the Installations
+ * @return Return the price of all the Installations
+ */
public long getCleaningListPrice() {
long price = 0;
for(Cleaning cleaning : cleaningList) {
@@ -148,18 +282,30 @@ public long getCleaningListPrice() {
return price;
}
+ /**
+ * Get the price of all the Installations
+ * @return Return the price of all the Installations
+ */
public long getInstallationListPrice() {
long price = 0;
- for(Cleaning cleaning : cleaningList) {
- price += cleaning.getPrice();
+ for(Installation installation: installationList) {
+ price += installation.getPrice();
}
return price;
}
+ /**
+ * Get the price of all the Services
+ * @return Return the price of all the Services
+ */
public long getPrice() {
return this.getBuildingListPrice() + this.getCleaningListPrice() + this.getInstallationListPrice();
}
+ /**
+ * Get the cost of all the Buildings
+ * @return Return the cost of all the Buildings
+ */
public long getBuildingListCost() {
long cost = 0;
for(Building building : buildingList) {
@@ -168,6 +314,10 @@ public long getBuildingListCost() {
return cost;
}
+ /**
+ * Get the cost of all the Cleanings
+ * @return Return the cost of all the Cleanings
+ */
public long getCleaningListCost() {
long cost = 0;
for(Cleaning cleaning : cleaningList) {
@@ -176,47 +326,81 @@ public long getCleaningListCost() {
return cost;
}
+ /**
+ * Get the cost of all the Installations
+ * @return Return the cost of all the Installations
+ */
public long getInstallationListCost() {
long cost = 0;
- for(Cleaning cleaning : cleaningList) {
- cost += cleaning.getCost();
+ for(Installation installation : installationList) {
+ cost += installation.getCost();
}
return cost;
}
+ /**
+ * Get the cost of all the Services
+ * @return Return the cost of all the Services
+ */
public long getCost() {
return this.getBuildingListCost() + this.getCleaningListCost() + this.getInstallationListCost();
}
+ /**
+ * Indicates that the WorkOrder is finished
+ * @return Return the status of the WorkOrder
+ */
public boolean isFinished() {
return this.status.equals("This work order has been completed.");
}
+ /**
+ * Indicates that the WorkOrder is canceled
+ * @return Return the status of the WorkOrder
+ */
public boolean isCanceled() {
return this.status.equals("This work order has been cancelled");
}
+ /**
+ * Indicates that the WorkOrder is on going
+ * @return Return the status of the WorkOrder
+ */
public boolean isOnGoing() {
return this.status.equals("This work order is still active");
}
+ /**
+ * Finalize the WorkOrder
+ */
public void finish() {
this.status = "This work order has been completed.";
this.finishedAt = new Date();
}
+ /**
+ * Cancel the WorkOrder
+ */
public void cancel() {
this.status = "This work order has been cancelled";
this.finishedAt = new Date();
}
+ /**
+ * Get the time between the initial date and the final date of a WordOrder
+ * @return Return the time between two dates in days
+ */
public long getWaitingTime() {
LocalDate createdAt = LocalDate.ofInstant(this.createdAt.toInstant(), ZoneId.systemDefault());
LocalDate finishedAt = LocalDate.ofInstant(this.finishedAt.toInstant(), ZoneId.systemDefault());
- return ChronoUnit.HOURS.between(createdAt, finishedAt);
+ return ChronoUnit.DAYS.between(createdAt, finishedAt);
}
- //calendar.setTime(date)
+ /**
+ *
+ * @param object Receive a random object
+ * @return Return true if the given object is equal to the current WorkOrder object, or false if they are not the same
+ */
@Override
public boolean equals(Object object) {
if (object instanceof WorkOrder) {
@@ -228,6 +412,10 @@ public boolean equals(Object object) {
return false;
}
+ /**
+ *
+ * @return Return a short formatted description of the object
+ */
@Override
public String toString() {
return "ID: " + this.id + ", Client ID: " + this.clientID + ", Technician ID: " + this.technicianID + ", Status: " + this.status + ", Building List: " + this.buildingList + ", Cleaning List: " + this.cleaningList + "Installation List: " + this.installationList + ", Description: " + this.description + ", Creation Date: " + this.createdAt + ", Completion Date: " + this.finishedAt + ", Satisfaction Score: " + this.clientSatisfaction + ", Payment Method: " + this.paymentMethod;
diff --git a/src/test/java/com/example/exa863_management_system_2023/dao/building/BuildingListImplementationTest.java b/src/test/java/com/example/exa863_management_system_2023/dao/building/BuildingListImplementationTest.java
new file mode 100644
index 0000000..5134adb
--- /dev/null
+++ b/src/test/java/com/example/exa863_management_system_2023/dao/building/BuildingListImplementationTest.java
@@ -0,0 +1,131 @@
+package com.example.exa863_management_system_2023.dao.building;
+
+import com.example.exa863_management_system_2023.model.Building;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class BuildingListImplementationTest {
+
+ private BuildingDAO buildingDAO;
+ private List buildings;
+
+ @BeforeEach
+ void setUp() {
+ buildingDAO = new BuildingListImplementation();
+ buildings = new ArrayList<>();
+ }
+
+ @Test
+ void testCreate() {
+ Building building1 = new Building("Change de Hard Disk", "Safely remove the old hard disk and install a new one", 120, 60);
+ building1.setID("68e7e64c-dd4b-11ed");
+ Building createdBuilding1 = buildingDAO.create(building1);
+ assertNotNull(createdBuilding1.getID());
+ assertEquals(building1.getID(), createdBuilding1.getID());
+ assertEquals(building1.getName(), createdBuilding1.getName());
+ assertEquals(building1.getDescription(), createdBuilding1.getDescription());
+ assertEquals(building1.getPrice(), createdBuilding1.getPrice());
+ assertEquals(building1.getCost(), createdBuilding1.getCost());
+
+ buildings.add(createdBuilding1);
+
+ Building building2 = new Building("RAM Upgrade", "Install additional RAM modules to increase memory capacity", 60, 30);
+ building1.setID("72980f1e-dd4b-11ed");
+ Building createdBuilding2 = buildingDAO.create(building2);
+ assertNotNull(createdBuilding2.getID());
+ assertEquals(building2.getID(), createdBuilding2.getID());
+ assertEquals(building2.getName(), createdBuilding2.getName());
+ assertEquals(building2.getDescription(), createdBuilding2.getDescription());
+ assertEquals(building2.getPrice(), createdBuilding2.getPrice());
+ assertEquals(building2.getCost(), createdBuilding2.getCost());
+
+ buildings.add(createdBuilding2);
+
+ // Test creating a building with a null argument and ensure it throws an exception.
+ assertThrows(NullPointerException.class, () -> buildingDAO.create(null));
+ }
+
+ @Test
+ void testFindMany() {
+ // Test finding all buildings in the list of buildings.
+ List foundBuildings = buildingDAO.findMany();
+ assertTrue(foundBuildings.isEmpty());
+
+ // Test finding many buildings and ensure the returned list contains all of them.
+ Building building1 = new Building("Change de Hard Disk", "Safely remove the old hard disk and install a new one", 120, 60);
+ Building createdBuilding1 = buildingDAO.create(building1);
+ buildings.add(createdBuilding1);
+ Building building2 = new Building("RAM Upgrade", "Install additional RAM modules to increase memory capacity", 60, 30);
+ Building createdBuilding2 = buildingDAO.create(building2);
+ buildings.add(createdBuilding2);
+ foundBuildings = buildingDAO.findMany();
+ assertEquals(2, foundBuildings.size());
+ assertTrue(foundBuildings.containsAll(buildings));
+
+ // Test finding buildings when the list is empty and ensure it returns an empty list.
+ buildingDAO.deleteMany();
+ foundBuildings = buildingDAO.findMany();
+ assertTrue(foundBuildings.isEmpty());
+ }
+
+ @Test
+ void testFindByID() {
+ Building building1 = new Building("Change Hard Disk", "Safely remove the old hard disk and install a new one", 120, 60);
+ Building createdBuilding1 = buildingDAO.create(building1);
+ buildings.add(createdBuilding1);
+ Building building2 = new Building("RAM Upgrade", "Install additional RAM modules to increase memory capacity", 60, 30);
+ Building createdBuilding2 = buildingDAO.create(building2);
+ buildings.add(createdBuilding2);
+
+ // Test finding a building by its ID and ensure it returns the correct building.
+ Building foundBuilding1 = buildingDAO.findByID(createdBuilding1.getID());
+ assertEquals(createdBuilding1, foundBuilding1);
+
+ // Test finding a building that does not exist and ensure it returns null.
+ Building foundBuilding3 = buildingDAO.findByID("invalid_id");
+ assertNull(foundBuilding3);
+ }
+
+ // Test update() method updates an existing building
+ @Test
+ public void testUpdate() throws Exception {
+ BuildingDAO buildingDAO1 = new BuildingListImplementation();
+ Building building = new Building("RAM Upgrade", "Install additional RAM modules to increase memory capacity", 60, 30);
+ building.setID("68e7e64c-dd4b-11ed");
+ buildingDAO1.create(building);
+
+ Building updatedBuilding = new Building("Change Hard Disk", "Safely remove the old hard disk and install a new one", 200, 100);
+ updatedBuilding.setID("68e7e64c-dd4b-11ed");
+
+ buildingDAO1.update(updatedBuilding);
+
+ assertEquals(updatedBuilding, buildingDAO1.findByID("68e7e64c-dd4b-11ed"));
+ }
+
+ // Test delete() method removes an existing building
+ @Test
+ public void testDelete() throws Exception {
+ BuildingDAO buildingDAO = new BuildingListImplementation();
+ Building building = new Building("RAM Upgrade", "Install additional RAM modules to increase memory capacity", 60, 30);
+ Building createdBuilding = buildingDAO.create(building);
+ buildingDAO.delete(createdBuilding.getID());
+ Building foundBuilding = buildingDAO.findByID(createdBuilding.getID());
+ assertNull(foundBuilding);
+ }
+
+ // Test deleteMany() method removes all buildings from the list
+ @Test
+ public void testDeleteMany() {
+ BuildingDAO buildingDAO = new BuildingListImplementation();
+ buildingDAO.create(new Building("RAM Upgrade", "Install additional RAM modules to increase memory capacity", 60, 30));
+ buildingDAO.create(new Building("Install Hard Disk", "Safely remove the old hard disk and install a new one", 200, 100));
+ buildingDAO.deleteMany();
+ List buildings = buildingDAO.findMany();
+ assertEquals(0, buildings.size());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/example/exa863_management_system_2023/dao/cleaning/CleaningListImplementationTest.java b/src/test/java/com/example/exa863_management_system_2023/dao/cleaning/CleaningListImplementationTest.java
new file mode 100644
index 0000000..13ab1a6
--- /dev/null
+++ b/src/test/java/com/example/exa863_management_system_2023/dao/cleaning/CleaningListImplementationTest.java
@@ -0,0 +1,7 @@
+package com.example.exa863_management_system_2023.dao.cleaning;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class CleaningListImplementationTest {
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/example/exa863_management_system_2023/dao/client/ClientListImplementationTest.java b/src/test/java/com/example/exa863_management_system_2023/dao/client/ClientListImplementationTest.java
new file mode 100644
index 0000000..6e8449f
--- /dev/null
+++ b/src/test/java/com/example/exa863_management_system_2023/dao/client/ClientListImplementationTest.java
@@ -0,0 +1,105 @@
+package com.example.exa863_management_system_2023.dao.client;
+
+import com.example.exa863_management_system_2023.model.Client;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+public class ClientListImplementationTest {
+
+ private ClientListImplementation clientListImplementation;
+
+ @Before
+ public void setUp() {
+ clientListImplementation = new ClientListImplementation();
+ }
+
+ @Test
+ public void testCreate() {
+ Client client = new Client("Matthew Delgado", "matthew.delgado@example.com", "Belmont, California(CA), 94002", "(262) 633-9393");
+ client.setID("72980f1e-dd4b-11ed");
+ clientListImplementation.create(client);
+ assertEquals(client, clientListImplementation.findByID(client.getID()));
+ }
+
+ @Test
+ public void testFindMany() {
+ Client client1 = new Client("Matthew Delgado", "matthew.delgado@example.com", "Belmont, California(CA), 94002", "(262) 633-9393");
+ client1.setID("72980f1e-dd4b-11ed");
+ clientListImplementation.create(client1);
+
+ Client client2 = new Client("Jane Doe", "jane.doe@example.com", "janedoe", "password");
+ client2.setID("1fb2dbb0-dd89-11ed");
+ clientListImplementation.create(client2);
+
+ List clients = clientListImplementation.findMany();
+ assertEquals(2, clients.size());
+ assertEquals(client1, clients.get(0));
+ assertEquals(client2, clients.get(1));
+ }
+
+ @Test
+ public void testFindByID() {
+ Client client = new Client("Matthew Delgado", "matthew.delgado@example.com", "Belmont, California(CA), 94002", "(262) 633-9393");
+ client.setID("72980f1e-dd4b-11ed");
+
+ clientListImplementation.create(client);
+ assertEquals(client, clientListImplementation.findByID(client.getID()));
+ assertNull(clientListImplementation.findByID("non-existent-id"));
+ }
+
+ @Test
+ public void testFindByName() {
+ Client client1 = new Client("Matthew Delgado", "matthew.delgado@example.com", "Belmont, California(CA), 94002", "(262) 633-9393");
+ client1.setID("72980f1e-dd4b-11ed");
+ clientListImplementation.create(client1);
+
+ Client client2 = new Client("Jane Doe", "jane.doe@example.com", "janedoe", "password");
+ client2.setID("1fb2dbb0-dd89-11ed");
+ clientListImplementation.create(client2);
+
+ List clients = clientListImplementation.findByName("John");
+
+ assertEquals(2, clients.size());
+ assertEquals(client1, clients.get(0));
+ assertEquals(client2, clients.get(1));
+ }
+
+ @Test
+ public void testUpdate() {
+ Client client1 = new Client("Matthew Delgado", "matthew.delgado@example.com", "Belmont, California(CA), 94002", "(262) 633-9393");
+ client1.setID("72980f1e-dd4b-11ed");
+ clientListImplementation.create(client1);
+
+ Client client2 = new Client("Jane Doe", "jane.doe@example.com", "janedoe", "password");
+ client2.setID("1fb2dbb0-dd89-11ed");
+ clientListImplementation.create(client2);
+
+ client1.setName("Smith");
+ clientListImplementation.update(client1);
+ assertEquals(client1, clientListImplementation.findByID(client1.getID()));
+ }
+
+ @Test
+ public void testDelete() {
+ Client client = new Client("Matthew Delgado", "matthew.delgado@example.com", "Belmont, California(CA), 94002", "(262) 633-9393");
+ clientListImplementation.create(client);
+ clientListImplementation.delete(client.getID());
+ assertNull(clientListImplementation.findByID(client.getID()));
+ }
+
+ @Test
+ public void testDeleteMany() {
+ Client client1 = new Client("Matthew Delgado", "matthew.delgado@example.com", "Belmont, California(CA), 94002", "(262) 633-9393");
+ clientListImplementation.create(client1);
+ Client client2 = new Client("Jane Doe", "jane.doe@example.com", "janedoe", "password");
+ clientListImplementation.create(client2);
+ clientListImplementation.deleteMany();
+ List clients = clientListImplementation.findMany();
+ assertEquals(0, clients.size());
+ }
+}
diff --git a/src/test/java/com/example/exa863_management_system_2023/dao/computerComponent/ComponentListImplementationTest.java b/src/test/java/com/example/exa863_management_system_2023/dao/computerComponent/ComponentListImplementationTest.java
new file mode 100644
index 0000000..180e20e
--- /dev/null
+++ b/src/test/java/com/example/exa863_management_system_2023/dao/computerComponent/ComponentListImplementationTest.java
@@ -0,0 +1,7 @@
+package com.example.exa863_management_system_2023.dao.computerComponent;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class ComponentListImplementationTest {
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/example/exa863_management_system_2023/dao/employee/EmployeeListImplementationTest.java b/src/test/java/com/example/exa863_management_system_2023/dao/employee/EmployeeListImplementationTest.java
new file mode 100644
index 0000000..2aabee2
--- /dev/null
+++ b/src/test/java/com/example/exa863_management_system_2023/dao/employee/EmployeeListImplementationTest.java
@@ -0,0 +1,7 @@
+package com.example.exa863_management_system_2023.dao.employee;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class EmployeeListImplementationTest {
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/example/exa863_management_system_2023/dao/installation/InstallationListImplementationTest.java b/src/test/java/com/example/exa863_management_system_2023/dao/installation/InstallationListImplementationTest.java
new file mode 100644
index 0000000..0dde830
--- /dev/null
+++ b/src/test/java/com/example/exa863_management_system_2023/dao/installation/InstallationListImplementationTest.java
@@ -0,0 +1,7 @@
+package com.example.exa863_management_system_2023.dao.installation;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class InstallationListImplementationTest {
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/example/exa863_management_system_2023/dao/manager/ManagerListImplementationTest.java b/src/test/java/com/example/exa863_management_system_2023/dao/manager/ManagerListImplementationTest.java
new file mode 100644
index 0000000..b9d5b9c
--- /dev/null
+++ b/src/test/java/com/example/exa863_management_system_2023/dao/manager/ManagerListImplementationTest.java
@@ -0,0 +1,7 @@
+package com.example.exa863_management_system_2023.dao.manager;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class ManagerListImplementationTest {
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/example/exa863_management_system_2023/dao/technician/TechnicianListImplementationTest.java b/src/test/java/com/example/exa863_management_system_2023/dao/technician/TechnicianListImplementationTest.java
new file mode 100644
index 0000000..25227c0
--- /dev/null
+++ b/src/test/java/com/example/exa863_management_system_2023/dao/technician/TechnicianListImplementationTest.java
@@ -0,0 +1,7 @@
+package com.example.exa863_management_system_2023.dao.technician;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class TechnicianListImplementationTest {
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/example/exa863_management_system_2023/dao/workOrder/WorkOrderListImplementationTest.java b/src/test/java/com/example/exa863_management_system_2023/dao/workOrder/WorkOrderListImplementationTest.java
new file mode 100644
index 0000000..928c203
--- /dev/null
+++ b/src/test/java/com/example/exa863_management_system_2023/dao/workOrder/WorkOrderListImplementationTest.java
@@ -0,0 +1,7 @@
+package com.example.exa863_management_system_2023.dao.workOrder;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class WorkOrderListImplementationTest {
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/example/exa863_management_system_2023/model/BuildingTest.java b/src/test/java/com/example/exa863_management_system_2023/model/BuildingTest.java
index 81f57a1..2165db1 100644
--- a/src/test/java/com/example/exa863_management_system_2023/model/BuildingTest.java
+++ b/src/test/java/com/example/exa863_management_system_2023/model/BuildingTest.java
@@ -25,6 +25,8 @@ public void setUp() {
stock.add(component1);
stock.add(component2);
stock.add(component3);
+
+ assertEquals(3, stock.size());
}
@Test
@@ -40,35 +42,19 @@ public void testConstructor() {
assertTrue(building.getUsedComponents().isEmpty());
}
- @Test
- public void testAddUsedComponent() {
- Building building = new Building("Change RAM", "Safely remove the RAM memory and install a new one", 120, 60);
- building.addUsedComponent(stock.get(2), 1);
-
- assertEquals(1, building.getUsedComponents().size());
- assertEquals(stock.get(2), building.getUsedComponents().get(0));
- assertEquals(19, stock.get(0).getQuantity());
- }
-
@Test
public void testEquals() {
Building building1 = new Building("Change de Hard Disk", "Safely remove the old hard disk and install a new one", 120, 60);
building1.setID("68e7e64c-dd4b-11ed");
Building building2 = new Building("RAM Upgrade", "Install additional RAM modules to increase memory capacity", 60, 30);
- building2.setID("72980f1e-dd4b-11ed\"");
- Building building3 = new Building("GPU Upgrade", "Install a new graphics card to improve visual performance", 120, 60);
- building3.setID("68e7e64c-dd4b-11ed");
+ building2.setID("72980f1e-dd4b-11ed");
//Test equality of two different components with different IDs
assertNotEquals(building1, building2);
- //Test equality of two different components with the same ID
- assertNotEquals(building1, building3);
-
//Test equality of the same component
assertEquals(building1, building1);
assertEquals(building2, building2);
- assertEquals(building3, building3);
//Null object
assertNotEquals(null, building1);
diff --git a/src/test/java/com/example/exa863_management_system_2023/model/CleaningTest.java b/src/test/java/com/example/exa863_management_system_2023/model/CleaningTest.java
index 1b03f91..74090ba 100644
--- a/src/test/java/com/example/exa863_management_system_2023/model/CleaningTest.java
+++ b/src/test/java/com/example/exa863_management_system_2023/model/CleaningTest.java
@@ -25,7 +25,9 @@ public void testConstructor() {
public void testAddComponent() {
Cleaning cleaning = new Cleaning("Cleaning peripheral components", "Remove dirt and grime", 70, 25);
ComputerComponent component1 = new ComputerComponent("Keyboard", "Wireless keyboard", "Microsoft");
+ component1.setID("c28c7bbe-dd45-11ed");
ComputerComponent component2 = new ComputerComponent("Mouse", "Wireless mouse", "Maxprint");
+ component2.setID("d9c0adb4-dd45-11ed");
cleaning.addComponent(component1);
cleaning.addComponent(component2);
assertEquals(2, cleaning.getComponents().size());
@@ -39,19 +41,13 @@ public void testEquals() {
cleaning1.setID("c28c7bbe-dd45-11ed");
Cleaning cleaning2 = new Cleaning("Clean Computer", "Clean computer components", 120, 70);
cleaning2.setID("d9c0adb4-dd45-11ed");
- Cleaning cleaning3 = new Cleaning("Clean Screen", "Clean computer screen", 80, 40);
- cleaning3.setID("c28c7bbe-dd45-11ed");
//Test equality of two different components with different IDs
assertNotEquals(cleaning1, cleaning2);
- //Test equality of two different components with the same ID
- assertNotEquals(cleaning1, cleaning3);
-
//Test equality of the same component
assertEquals(cleaning1, cleaning1);
assertEquals(cleaning2, cleaning2);
- assertEquals(cleaning3, cleaning3);
//Null object
assertNotEquals(null, cleaning1);
diff --git a/src/test/java/com/example/exa863_management_system_2023/model/ClientTest.java b/src/test/java/com/example/exa863_management_system_2023/model/ClientTest.java
index c6e3fe6..988c57f 100644
--- a/src/test/java/com/example/exa863_management_system_2023/model/ClientTest.java
+++ b/src/test/java/com/example/exa863_management_system_2023/model/ClientTest.java
@@ -18,13 +18,13 @@ public void testConstructor() {
@Test
public void testEquals() {
- Client client1 = new Client("John Smith", "john.smith@example.com", "johnsmith", "password");
+ Client client1 = new Client("John Smith", "john.smith@example.com", "245 Cold Storage Rd, Craig, Alaska 99921, USA", "password");
client1.setID("a908ffa4-dd37-11ed");
- Client client2 = new Client("Jane Doe", "jane.doe@example.com", "janedoe", "password");
+ Client client2 = new Client("Jane Doe", "jane.doe@example.com", "1536 Stellar Dr, Kenai, Alaska 99611, USA", "password");
client2.setID("ed198b64-dd37-11ed");
- Client client3 = new Client("John Smith", "john.smith@example.com", "johnsmith", "password");
+ Client client3 = new Client("John Smith", "john.smith@example.com", "257 Fireweed Ln, Ketchikan, Alaska 99901, USA", "password");
client3.setID("a908ffa4-dd37-11ed");
- Client client4 = new Client("John Smith", "john.smith@example.com", "johndoe", "password");
+ Client client4 = new Client("John Smith", "john.smith@example.com", "23475 Glacier View Dr, Eagle River, Alaska 99577, USA", "password");
client4.setID("f89174f2-dd37-11ed");
//Verify that two clients with the same ID are equal
diff --git a/src/test/java/com/example/exa863_management_system_2023/model/ComputerComponentTest.java b/src/test/java/com/example/exa863_management_system_2023/model/ComputerComponentTest.java
index 2c09cd9..983de4a 100644
--- a/src/test/java/com/example/exa863_management_system_2023/model/ComputerComponentTest.java
+++ b/src/test/java/com/example/exa863_management_system_2023/model/ComputerComponentTest.java
@@ -46,19 +46,13 @@ public void testEquals() {
component1.setID("11221ccc-dd3f-11ed");
ComputerComponent component2 = new ComputerComponent("GPU", "Nvidia GeForce RTX 3080", "Nvidia", "XYZ789", 800, 1000, 5);
component2.setID("20012e04-dd3f-11ed");
- ComputerComponent component3 = new ComputerComponent("RAM", "Corsair Vengeance LPX", "Corsair", "DEF456", 50, 70, 20);
- component3.setID("11221ccc-dd3f-11ed");
//Test equality of two different components with different IDs
assertNotEquals(component1, component2);
- //Test equality of two different components with the same ID
- assertNotEquals(component1, component3);
-
//Test equality of the same component
assertEquals(component1, component1);
assertEquals(component2, component2);
- assertEquals(component3, component3);
//Null object
assertNotEquals(null, component1);
@@ -66,9 +60,9 @@ public void testEquals() {
@Test
public void testToString() {
- ComputerComponent component = new ComputerComponent("CPU", "Central Processing Unit", "Intel", "12345", 100, 200, 5);
+ ComputerComponent component = new ComputerComponent("CPU", "Central Processing Unit", "Intel", "ABC123", 100, 200, 5);
component.setID("6e056406-dc97-11ed");
- String expected = "ID: 6e056406-dc97-11ed, Description: Central Processing Unit, Manufacturer: Intel, Serial Number: ABC123, Unit Cost: 100, Unit Price: 200, Quantity: 5";
+ String expected = "ID: 6e056406-dc97-11ed, Name: CPU, Description: Central Processing Unit, Manufacturer: Intel, Serial Number: ABC123, Unit Cost: 100, Unit Price: 200, Quantity: 5";
String actual = component.toString();
assertEquals(expected, actual);
}
diff --git a/src/test/java/com/example/exa863_management_system_2023/model/InstallationTest.java b/src/test/java/com/example/exa863_management_system_2023/model/InstallationTest.java
index cca1950..eaf4ea3 100644
--- a/src/test/java/com/example/exa863_management_system_2023/model/InstallationTest.java
+++ b/src/test/java/com/example/exa863_management_system_2023/model/InstallationTest.java
@@ -43,19 +43,13 @@ public void testEquals() {
installation1.setID("68e7e64c-dd4b-11ed");
Installation installation2 = new Installation("Browser Setup", "Install and configure your preferred web browser", 50, 0, "MacOS");
installation2.setID("72980f1e-dd4b-11ed");
- Installation installation3 = new Installation("Driver Installation", "Install and update drivers for your computer's hardware components", 80, 0, "Ubuntu");
- installation3.setID("68e7e64c-dd4b-11ed");
//Test equality of two different components with different IDs
assertNotEquals(installation1, installation2);
- //Test equality of two different components with the same ID
- assertNotEquals(installation1, installation3);
-
//Test equality of the same component
assertEquals(installation1, installation1);
assertEquals(installation2, installation2);
- assertEquals(installation3, installation3);
//Null object
assertNotEquals(null, installation1);
diff --git a/src/test/java/com/example/exa863_management_system_2023/model/WorkOrderTest.java b/src/test/java/com/example/exa863_management_system_2023/model/WorkOrderTest.java
index 9e211bd..1562401 100644
--- a/src/test/java/com/example/exa863_management_system_2023/model/WorkOrderTest.java
+++ b/src/test/java/com/example/exa863_management_system_2023/model/WorkOrderTest.java
@@ -58,22 +58,19 @@ void testAddInstallationService() {
@Test
void testGetBuildingListPrice() {
workOrder.addBuildingService(building);
- workOrder.addBuildingService(building);
- assertEquals(200, workOrder.getBuildingListPrice());
+ assertEquals(120, workOrder.getBuildingListPrice());
}
@Test
void testGetCleaningListPrice() {
workOrder.addCleaningService(cleaning);
- workOrder.addCleaningService(cleaning);
- assertEquals(100, workOrder.getCleaningListPrice());
+ assertEquals(70, workOrder.getCleaningListPrice());
}
@Test
void testGetInstallationListPrice() {
workOrder.addInstallationService(installation);
- workOrder.addInstallationService(installation);
- assertEquals(400, workOrder.getInstallationListPrice());
+ assertEquals(100, workOrder.getInstallationListPrice());
}
@Test
@@ -81,28 +78,25 @@ void testGetPrice() {
workOrder.addBuildingService(building);
workOrder.addCleaningService(cleaning);
workOrder.addInstallationService(installation);
- assertEquals(350, workOrder.getPrice());
+ assertEquals(290, workOrder.getPrice());
}
@Test
void testGetBuildingListCost() {
workOrder.addBuildingService(building);
- workOrder.addBuildingService(building);
- assertEquals(100, workOrder.getBuildingListCost());
+ assertEquals(60, workOrder.getBuildingListCost());
}
@Test
void testGetCleaningListCost() {
workOrder.addCleaningService(cleaning);
- workOrder.addCleaningService(cleaning);
- assertEquals(50, workOrder.getCleaningListCost());
+ assertEquals(25, workOrder.getCleaningListCost());
}
@Test
void testGetInstallationListCost() {
workOrder.addInstallationService(installation);
- workOrder.addInstallationService(installation);
- assertEquals(200, workOrder.getInstallationListCost());
+ assertEquals(0, workOrder.getInstallationListCost());
}
@Test