diff options
| author | Akash Keshav <112591754+domesticchores@users.noreply.github.com> | 2025-02-27 21:03:35 -0500 | 
|---|---|---|
| committer | Akash Keshav <112591754+domesticchores@users.noreply.github.com> | 2025-02-27 21:03:35 -0500 | 
| commit | 79d8806a34abe980093fb4b48806a57e27e28365 (patch) | |
| tree | 9b93e305367f834d24505b9d74e4100efeb441a2 /ufund-api/src/test/java/com/ufund | |
| parent | b04d873dfd757e1130845678a57ad8cf818b692e (diff) | |
| parent | df48929a7deb0dda072206ac5c32744dc95f20c5 (diff) | |
| download | JellySolutions-79d8806a34abe980093fb4b48806a57e27e28365.tar.gz JellySolutions-79d8806a34abe980093fb4b48806a57e27e28365.tar.bz2 JellySolutions-79d8806a34abe980093fb4b48806a57e27e28365.zip  | |
Merge branch 'main' of https://github.com/RIT-SWEN-261-02/team-project-2245-swen-261-02-2b
Diffstat (limited to 'ufund-api/src/test/java/com/ufund')
| -rw-r--r-- | ufund-api/src/test/java/com/ufund/api/ufundapi/model/NeedTest.java | 78 | 
1 files changed, 78 insertions, 0 deletions
diff --git a/ufund-api/src/test/java/com/ufund/api/ufundapi/model/NeedTest.java b/ufund-api/src/test/java/com/ufund/api/ufundapi/model/NeedTest.java new file mode 100644 index 0000000..50b5cf2 --- /dev/null +++ b/ufund-api/src/test/java/com/ufund/api/ufundapi/model/NeedTest.java @@ -0,0 +1,78 @@ +package com.ufund.api.ufundapi.model; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; + +import com.ufund.api.ufundapi.model.Need.GoalType; + +@Tag("Model-tier") +public class NeedTest { + +    @Test +    public void createNeed() { + +        String name = "Jellyfish"; +        int id = 0; +        double maxGoal = 100.00; +        GoalType type = GoalType.MONETARY; +        Need need = new Need(name, id, maxGoal, type); + +        assertNotNull(need); + +    } + +    @Test +    public void testFields() { +        String name = "Jellyfish"; +        int id = 0; +        double maxGoal = 100.00; +        GoalType type = GoalType.MONETARY; +        Need need = new Need(name, id, maxGoal, type); + +        +        assertEquals(name, need.getName()); +        assertEquals(id, need.getId()); +        assertEquals(maxGoal, need.getMaxGoal()); +        assertEquals(type, need.getType()); +    } + +    @Test +    public void testCurrentGoal() { +        String name = "Jellyfish"; +        int id = 0; +        double maxGoal = 100.00; +        GoalType type = GoalType.MONETARY; +        Need need = new Need(name, id, maxGoal, type); + +        double current = 0.00; +        need.setCurrent(current); +        assertEquals(need.getCurrent(), current); + +        current = 100.00; +        need.setCurrent(current); +        assertEquals(need.getCurrent(), current); + +        current = -100.00; +        need.setCurrent(current); +        assertEquals(need.getCurrent(), current); + +    } +    @Test +    public void testFilterAttributes() { + +        String name = "Jellyfish"; +        int id = 0; +        double maxGoal = 100.00; +        GoalType type = GoalType.MONETARY; +        Need need = new Need(name, id, maxGoal, type); + +        String[] filterAttributes = {"seaweed", "divers", "pacific", "plankton"}; + +        need.setFilterAttributes(filterAttributes); + +        assertEquals(need.getFilterAttributes(), filterAttributes); +    } + +}  | 
