-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add new column on medicalinventory * add validate ward inventory row function * Remove uneccessary format code * Remove uneccessary format code * Write unit test for validateWardinventory * Add the standard license header block * Remove reason attribut * Add actualize inventory row function * update validateMedicalWardInventoryRow function * Update src/main/java/org/isf/medicalinventory/manager/MedicalInventoryManager.java * Applying suggestion for change * Fix test coverage * Update test validation medical ward inventory row * Add actualize inventory row test --------- Co-authored-by: Alessandro Domanico <[email protected]>
- Loading branch information
1 parent
125822a
commit 43581de
Showing
3 changed files
with
464 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
src/test/java/org/isf/medicalsinventory/TestMedicalWardInventory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Open Hospital (www.open-hospital.org) | ||
* Copyright © 2006-2024 Informatici Senza Frontiere ([email protected]) | ||
* | ||
* Open Hospital is a free and open source software for healthcare data management. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* https://www.gnu.org/licenses/gpl-3.0-standalone.html | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package org.isf.medicalsinventory; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.within; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.temporal.ChronoUnit; | ||
|
||
import org.isf.medicalinventory.model.InventoryStatus; | ||
import org.isf.medicalinventory.model.InventoryType; | ||
import org.isf.medicalinventory.model.MedicalInventory; | ||
import org.isf.utils.exception.OHException; | ||
import org.isf.utils.time.TimeTools; | ||
import org.isf.ward.model.Ward; | ||
|
||
public class TestMedicalWardInventory { | ||
private int id = 1; | ||
private String status = InventoryStatus.draft.toString(); | ||
private LocalDateTime inventoryDate = TimeTools.getNow(); | ||
private String user = "admin"; | ||
private String inventoryReference = "REFERENCE"; | ||
private String inventoryType = InventoryType.ward.toString(); | ||
private String ward = "Z"; | ||
|
||
public MedicalInventory setup(Ward ward, boolean usingSet) throws OHException { | ||
MedicalInventory medicalInventory; | ||
|
||
if (usingSet) { | ||
medicalInventory = new MedicalInventory(); | ||
setParameters(medicalInventory); | ||
} else { | ||
// create MedicalInventory with all parameters | ||
medicalInventory = new MedicalInventory(id, status, inventoryDate, user, inventoryReference, inventoryType, ward.getCode()); | ||
} | ||
return medicalInventory; | ||
} | ||
|
||
public void setParameters(MedicalInventory medicalInventory) { | ||
medicalInventory.setId(id); | ||
medicalInventory.setStatus(status); | ||
medicalInventory.setInventoryDate(inventoryDate); | ||
medicalInventory.setUser(user); | ||
medicalInventory.setInventoryReference(inventoryReference); | ||
medicalInventory.setInventoryType(inventoryType); | ||
medicalInventory.setWard(ward); | ||
} | ||
|
||
public void check(MedicalInventory medicalInventory, int id) { | ||
assertThat(medicalInventory.getId()).isEqualTo(id); | ||
assertThat(medicalInventory.getStatus()).isEqualTo(status); | ||
assertThat(medicalInventory.getInventoryDate()).isCloseTo(inventoryDate, within(1, ChronoUnit.SECONDS)); | ||
assertThat(medicalInventory.getUser()).isEqualTo(user); | ||
assertThat(medicalInventory.getInventoryReference()).isEqualTo(inventoryReference); | ||
assertThat(medicalInventory.getInventoryType()).isEqualTo(inventoryType); | ||
assertThat(medicalInventory.getWard()).isEqualTo(ward); | ||
} | ||
} |
Oops, something went wrong.