Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import static org.junit.Assert.*;
- import java.time.LocalDate;
- import org.junit.Test;
- import ordination.Medicine;
- import ordination.PN;
- public class TestPN {
- Medicine m1 = new Medicine("Fucidin", 0.025, 0.025, 0.025, "Pill");
- LocalDate start = LocalDate.of(2019, 1, 1);
- LocalDate end = LocalDate.of(2019, 2, 14);
- PN tc1 = new PN(start, end, m1, 4);
- @Test
- public void testGetNumberOfTimes() {
- assertEquals(14, tc1.getNumberOfTimes()); // AssertionError: expected:<14> but was:<[]>
- }
- @Test
- public void testGivDosis() {
- assertEquals(false, tc1.givDosis(LocalDate.of(15, 10, 10)));
- assertEquals(true, tc1.givDosis(LocalDate.of(19, 01, 21))); // AssertionError: expected:<true> but was:<false>
- assertEquals(true, tc1.givDosis(LocalDate.of(19, 2, 13))); // AssertionError: expected:<true> but was:<false>
- assertEquals(true, tc1.givDosis(LocalDate.of(19, 1, 2))); // AssertionError: expected:<true> but was:<false>
- assertEquals(false, tc1.givDosis(LocalDate.of(19, 9, 8)));
- assertEquals(false, tc1.givDosis(LocalDate.of(17, 1, 21)));
- }
- @Test
- public void testDayDosis() {
- tc1.givDosis(LocalDate.of(19, 10, 4));
- double tc1num = tc1.dayDosis();
- assertEquals(1, tc1tal, 0.001); // AssertionError: expected:<1.0> but was:<0.0>
- }
- @Test
- public void testTotalDosis() {
- tc1.givDosis(LocalDate.of(19, 10, 4));
- tc1.givDosis(LocalDate.of(19, 10, 5));
- tc1.givDosis(LocalDate.of(19, 10, 6));
- tc1.givDosis(LocalDate.of(19, 10, 7));
- tc1.givDosis(LocalDate.of(19, 10, 8));
- double tc1num = tc1.totalDosis();
- assertEquals(5, tc1tal, 0.001); // AssertionError: expected:<5> but was:<0.0>
- }
- @Test
- public void testGetNumberOfTimesGiven() {
- assertEquals(5, tc1.getNumberOfTimesGiven()); // AssertionError: expected:<5> but was:<0.0>
- }
- @Test
- public void testGetNumberOfUnits() {
- assertEquals(4, tc1.getNumberOfUnits(), 0.01);
- }
- @Test
- public void testGetMedicine() {
- assertEquals(l1, tc1.getMedicine());
- }
- @Test
- public void testGetType() {
- assertEquals("PN", tc1.getType());
- }
- }
Add Comment
Please, Sign In to add comment