Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ordination;
- import static org.junit.Assert.*;
- import java.time.LocalDate;
- import java.time.LocalTime;
- import org.junit.Before;
- import org.junit.Test;
- public class DagligSkaevTest {
- @Before
- public void setUp() throws Exception {
- }
- Laegemiddel test1 = new Laegemiddel("test1", 1, 2, 4, "en pille");
- LocalDate start = LocalDate.of(2019,2,1);
- LocalDate slut = LocalDate.of(2019,2,3);
- DagligSkaev tc1 = new DagligSkaev(start, slut, test1);
- DagligSkaev tc2 = new DagligSkaev(start, slut, test1);
- DagligSkaev tc3 = new DagligSkaev(start, slut, test1);
- DagligSkaev tc4 = new DagligSkaev(start, slut, test1);
- LocalTime tid1 = LocalTime.of(9, 30);
- LocalTime tid2 = LocalTime.of(10, 00);
- LocalTime tid3 = LocalTime.of(13, 00);
- LocalTime tid4 = LocalTime.of(16, 00);
- LocalTime tid5 = LocalTime.of(19, 30);
- LocalTime tid6 = LocalTime.of(22, 30);
- LocalTime tid7 = LocalTime.of(23, 30);
- @Test
- public void SamletDosistest() {
- tc1.opretDosis(tid2, 4);
- double tc1tal = tc1.samletDosis();
- assertEquals(12,tc1tal,0.001);
- tc2.opretDosis(tid2, 4);
- tc2.opretDosis(tid4, 2);
- double tc2tal = tc2.samletDosis();
- assertEquals(18,tc2tal,0.001);
- tc3.opretDosis(tid2, 4);
- tc3.opretDosis(tid4, 2);
- tc3.opretDosis(tid6, 1);
- double tc3tal = tc3.samletDosis();
- assertEquals(21,tc3tal,0.001);
- tc4.opretDosis(tid1, 3);
- tc4.opretDosis(tid3, 4);
- tc4.opretDosis(tid5, 1);
- tc4.opretDosis(tid7, 5);
- double tc4tal = tc4.samletDosis();
- assertEquals(39,tc4tal,0.001);
- }
- @Test
- public void doegnDosistest() {
- tc1.opretDosis(tid2, 4);
- double tc1tal = tc1.doegnDosis();
- assertEquals(4,tc1tal,0.001);
- tc2.opretDosis(tid2, 4);
- tc2.opretDosis(tid4, 2);
- double tc2tal = tc2.doegnDosis();
- assertEquals(6,tc2tal,0.001);
- tc3.opretDosis(tid2, 4);
- tc3.opretDosis(tid4, 2);
- tc3.opretDosis(tid6, 1);
- double tc3tal = tc3.doegnDosis();
- assertEquals(7,tc3tal,0.001);
- tc4.opretDosis(tid1, 3);
- tc4.opretDosis(tid3, 4);
- tc4.opretDosis(tid5, 1);
- tc4.opretDosis(tid7, 5);
- double tc4tal = tc4.doegnDosis();
- assertEquals(13,tc4tal,0.001);
- }
- }
Add Comment
Please, Sign In to add comment