LoganBlackisle

TestPN

Sep 15th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.07 KB | None | 0 0
  1. package test;
  2.  
  3. import static org.junit.Assert.*;
  4. import java.time.LocalDate;
  5. import org.junit.Test;
  6. import ordination.Medicine;
  7. import ordination.PN;
  8.  
  9. public class TestPN {
  10.     Medicine m1 = new Medicine("Fucidin", 0.025, 0.025, 0.025, "Pill");
  11.     LocalDate start = LocalDate.of(2019, 1, 1);
  12.     LocalDate end = LocalDate.of(2019, 2, 14);
  13.     PN tc1 = new PN(start, end, m1, 4);
  14.  
  15.     @Test
  16.     public void testGetNumberOfTimes() {
  17.         assertEquals(14, tc1.getNumberOfTimes()); // AssertionError: expected:<14> but was:<[]>
  18.     }
  19.  
  20.     @Test
  21.     public void testGivDosis() {
  22.         assertEquals(false, tc1.givDosis(LocalDate.of(15, 10, 10)));
  23.  
  24.         assertEquals(true, tc1.givDosis(LocalDate.of(19, 01, 21)));  // AssertionError: expected:<true> but was:<false>
  25.  
  26.         assertEquals(true, tc1.givDosis(LocalDate.of(19, 2, 13)));  // AssertionError: expected:<true> but was:<false>
  27.  
  28.         assertEquals(true, tc1.givDosis(LocalDate.of(19, 1, 2)));  // AssertionError: expected:<true> but was:<false>
  29.  
  30.         assertEquals(false, tc1.givDosis(LocalDate.of(19, 9, 8)));
  31.  
  32.         assertEquals(false, tc1.givDosis(LocalDate.of(17, 1, 21)));
  33.     }
  34.  
  35.     @Test
  36.     public void testDayDosis() {
  37.         tc1.givDosis(LocalDate.of(19, 10, 4));
  38.         double tc1num = tc1.dayDosis();
  39.         assertEquals(1, tc1tal, 0.001); // AssertionError: expected:<1.0> but was:<0.0>
  40.     }
  41.  
  42.     @Test
  43.     public void testTotalDosis() {
  44.         tc1.givDosis(LocalDate.of(19, 10, 4));
  45.         tc1.givDosis(LocalDate.of(19, 10, 5));
  46.         tc1.givDosis(LocalDate.of(19, 10, 6));
  47.         tc1.givDosis(LocalDate.of(19, 10, 7));
  48.         tc1.givDosis(LocalDate.of(19, 10, 8));
  49.         double tc1num = tc1.totalDosis();
  50.         assertEquals(5, tc1tal, 0.001); // AssertionError: expected:<5> but was:<0.0>
  51.     }
  52.  
  53.     @Test
  54.     public void testGetNumberOfTimesGiven() {
  55.         assertEquals(5, tc1.getNumberOfTimesGiven()); // AssertionError: expected:<5> but was:<0.0>
  56.     }
  57.  
  58.     @Test
  59.     public void testGetNumberOfUnits() {
  60.         assertEquals(4, tc1.getNumberOfUnits(), 0.01);
  61.     }
  62.  
  63.     @Test
  64.     public void testGetMedicine() {
  65.         assertEquals(l1, tc1.getMedicine());
  66.     }
  67.  
  68.     @Test
  69.     public void testGetType() {
  70.         assertEquals("PN", tc1.getType());
  71.     }
  72. }
Add Comment
Please, Sign In to add comment