LoganBlackisle

Untitled

Sep 12th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. package ordination;
  2.  
  3. import static org.junit.Assert.*;
  4.  
  5. import java.time.LocalDate;
  6. import java.time.LocalTime;
  7.  
  8. import org.junit.Before;
  9. import org.junit.Test;
  10.  
  11. public class DagligSkaevTest {
  12.  
  13. @Before
  14. public void setUp() throws Exception {
  15. }
  16. Laegemiddel test1 = new Laegemiddel("test1", 1, 2, 4, "en pille");
  17. LocalDate start = LocalDate.of(2019,2,1);
  18. LocalDate slut = LocalDate.of(2019,2,3);
  19. DagligSkaev tc1 = new DagligSkaev(start, slut, test1);
  20. DagligSkaev tc2 = new DagligSkaev(start, slut, test1);
  21. DagligSkaev tc3 = new DagligSkaev(start, slut, test1);
  22. DagligSkaev tc4 = new DagligSkaev(start, slut, test1);
  23. LocalTime tid1 = LocalTime.of(9, 30);
  24. LocalTime tid2 = LocalTime.of(10, 00);
  25. LocalTime tid3 = LocalTime.of(13, 00);
  26. LocalTime tid4 = LocalTime.of(16, 00);
  27. LocalTime tid5 = LocalTime.of(19, 30);
  28. LocalTime tid6 = LocalTime.of(22, 30);
  29. LocalTime tid7 = LocalTime.of(23, 30);
  30.  
  31.  
  32. @Test
  33. public void SamletDosistest() {
  34.  
  35. tc1.opretDosis(tid2, 4);
  36.  
  37. double tc1tal = tc1.samletDosis();
  38. assertEquals(12,tc1tal,0.001);
  39.  
  40. tc2.opretDosis(tid2, 4);
  41. tc2.opretDosis(tid4, 2);
  42.  
  43. double tc2tal = tc2.samletDosis();
  44. assertEquals(18,tc2tal,0.001);
  45.  
  46. tc3.opretDosis(tid2, 4);
  47. tc3.opretDosis(tid4, 2);
  48. tc3.opretDosis(tid6, 1);
  49.  
  50. double tc3tal = tc3.samletDosis();
  51. assertEquals(21,tc3tal,0.001);
  52.  
  53. tc4.opretDosis(tid1, 3);
  54. tc4.opretDosis(tid3, 4);
  55. tc4.opretDosis(tid5, 1);
  56. tc4.opretDosis(tid7, 5);
  57.  
  58. double tc4tal = tc4.samletDosis();
  59. assertEquals(39,tc4tal,0.001);
  60. }
  61. @Test
  62. public void doegnDosistest() {
  63. tc1.opretDosis(tid2, 4);
  64.  
  65. double tc1tal = tc1.doegnDosis();
  66. assertEquals(4,tc1tal,0.001);
  67.  
  68. tc2.opretDosis(tid2, 4);
  69. tc2.opretDosis(tid4, 2);
  70.  
  71. double tc2tal = tc2.doegnDosis();
  72. assertEquals(6,tc2tal,0.001);
  73.  
  74. tc3.opretDosis(tid2, 4);
  75. tc3.opretDosis(tid4, 2);
  76. tc3.opretDosis(tid6, 1);
  77.  
  78. double tc3tal = tc3.doegnDosis();
  79. assertEquals(7,tc3tal,0.001);
  80.  
  81. tc4.opretDosis(tid1, 3);
  82. tc4.opretDosis(tid3, 4);
  83. tc4.opretDosis(tid5, 1);
  84. tc4.opretDosis(tid7, 5);
  85.  
  86. double tc4tal = tc4.doegnDosis();
  87. assertEquals(13,tc4tal,0.001);
  88. }
  89.  
  90. }
Add Comment
Please, Sign In to add comment