|
| 1 | +package com.codedifferently.lesson16.ezranyabuti; |
| 2 | + |
| 3 | +import static org.assertj.core.api.Assertions.assertThat; |
| 4 | + |
| 5 | +import java.util.ArrayList; |
| 6 | +import java.util.Arrays; |
| 7 | +import org.junit.jupiter.api.Test; |
| 8 | + |
| 9 | +public class PartyTest { |
| 10 | + |
| 11 | + @Test |
| 12 | + void testGetName() { |
| 13 | + Party party = |
| 14 | + new Party( |
| 15 | + "Everyday People", |
| 16 | + "Washington D.C.", |
| 17 | + "2025-06-012", |
| 18 | + false, |
| 19 | + 50.0, |
| 20 | + 0, |
| 21 | + Vibe.CHILL, |
| 22 | + new String[] {}); |
| 23 | + String expectedName = "Everyday People"; |
| 24 | + party.setName(expectedName); |
| 25 | + String actualName = party.getName(); |
| 26 | + assertThat(actualName).isEqualTo(expectedName); |
| 27 | + } |
| 28 | + |
| 29 | + @Test |
| 30 | + void testGetlocalDate() { |
| 31 | + Party party = |
| 32 | + new Party( |
| 33 | + "Everyday People", |
| 34 | + "Washington D.C.", |
| 35 | + "2025-06-012", |
| 36 | + false, |
| 37 | + 50.0, |
| 38 | + 0, |
| 39 | + Vibe.CHILL, |
| 40 | + new String[] {}); |
| 41 | + String expectedDate = "2025-06-012"; |
| 42 | + party.setLocalDate(expectedDate); |
| 43 | + String actualDate = party.getLocalDate(); |
| 44 | + assertThat(actualDate).isEqualTo(expectedDate); |
| 45 | + } |
| 46 | + |
| 47 | + @Test |
| 48 | + void testGetCoverCharge() { |
| 49 | + Party party = |
| 50 | + new Party( |
| 51 | + "Everyday People", |
| 52 | + "Washington D.C.", |
| 53 | + "2025-06-012", |
| 54 | + false, |
| 55 | + 50.0, |
| 56 | + 0, |
| 57 | + Vibe.CHILL, |
| 58 | + new String[] {}); |
| 59 | + Double expectedCharge = 50.0; |
| 60 | + party.setCoverCharge(expectedCharge); |
| 61 | + Double actualCharge = party.getCoverCharge(); |
| 62 | + assertThat(actualCharge).isEqualTo(expectedCharge); |
| 63 | + } |
| 64 | + |
| 65 | + @Test |
| 66 | + void testGetVibe() { |
| 67 | + Party party = |
| 68 | + new Party( |
| 69 | + "Everyday People", |
| 70 | + "Washington D.C.", |
| 71 | + "2025-06-012", |
| 72 | + false, |
| 73 | + 50.0, |
| 74 | + 0, |
| 75 | + Vibe.CHILL, |
| 76 | + new String[] {}); |
| 77 | + Vibe expectedVibe = Vibe.CHILL; |
| 78 | + party.setVibe(expectedVibe); |
| 79 | + Vibe actualVibe = party.getVibe(); |
| 80 | + assertThat(actualVibe).isEqualTo(expectedVibe); |
| 81 | + } |
| 82 | + |
| 83 | + @Test |
| 84 | + void testSetVibe() { |
| 85 | + Party party = |
| 86 | + new Party( |
| 87 | + "Everyday People", |
| 88 | + "Washington D.C.", |
| 89 | + "2025-06-012", |
| 90 | + false, |
| 91 | + 50.0, |
| 92 | + 0, |
| 93 | + Vibe.CHILL, |
| 94 | + new String[] {}); |
| 95 | + } |
| 96 | + |
| 97 | + @Test |
| 98 | + void testSetName() { |
| 99 | + Party party = |
| 100 | + new Party( |
| 101 | + "Everyday People", |
| 102 | + "Washington D.C.", |
| 103 | + "2025-06-012", |
| 104 | + false, |
| 105 | + 50.0, |
| 106 | + 0, |
| 107 | + Vibe.CHILL, |
| 108 | + new String[] {}); |
| 109 | + String expectedName = "Everyday People"; |
| 110 | + party.setName(expectedName); |
| 111 | + String actualName = party.getName(); |
| 112 | + assertThat(actualName).isEqualTo(expectedName); |
| 113 | + } |
| 114 | + |
| 115 | + @Test |
| 116 | + void testSetLocation() { |
| 117 | + Party party = |
| 118 | + new Party( |
| 119 | + "Everyday People", |
| 120 | + "Washington D.C.", |
| 121 | + "2025-06-012", |
| 122 | + false, |
| 123 | + 50.0, |
| 124 | + 0, |
| 125 | + Vibe.CHILL, |
| 126 | + new String[] {}); |
| 127 | + String expectedLocation = "Brooklyn"; |
| 128 | + party.setLocation(expectedLocation); |
| 129 | + String actualLocation = party.getLocation(); |
| 130 | + assertThat(actualLocation).isEqualTo(expectedLocation); |
| 131 | + } |
| 132 | + |
| 133 | + @Test |
| 134 | + void testGetLocation() { |
| 135 | + Party party = |
| 136 | + new Party( |
| 137 | + "Everyday People", |
| 138 | + "Washington D.C.", |
| 139 | + "2025-06-012", |
| 140 | + false, |
| 141 | + 50.0, |
| 142 | + 0, |
| 143 | + Vibe.CHILL, |
| 144 | + new String[] {}); |
| 145 | + String expectedLocation = "Brooklyn"; |
| 146 | + party.setLocation(expectedLocation); |
| 147 | + String actualLocation = party.getLocation(); |
| 148 | + assertThat(actualLocation).isEqualTo(expectedLocation); |
| 149 | + } |
| 150 | + |
| 151 | + @Test |
| 152 | + void testGetPrivate() { |
| 153 | + Party party = |
| 154 | + new Party( |
| 155 | + "Everyday People", |
| 156 | + "Washington D.C.", |
| 157 | + "2025-06-012", |
| 158 | + false, |
| 159 | + 50.0, |
| 160 | + 0, |
| 161 | + Vibe.CHILL, |
| 162 | + new String[] {}); |
| 163 | + Boolean expectedPrivate = false; |
| 164 | + party.setIsPrivate(expectedPrivate); |
| 165 | + Boolean actualPrivate = party.getIsPrivate(); |
| 166 | + assertThat(actualPrivate).isEqualTo(expectedPrivate); |
| 167 | + } |
| 168 | + |
| 169 | + @Test |
| 170 | + void testSetPrivate() { |
| 171 | + Party party = |
| 172 | + new Party( |
| 173 | + "Everyday People", |
| 174 | + "Washington D.C.", |
| 175 | + "2025-06-012", |
| 176 | + false, |
| 177 | + 50.0, |
| 178 | + 0, |
| 179 | + Vibe.CHILL, |
| 180 | + new String[] {}); |
| 181 | + Boolean expectedPrivate = true; |
| 182 | + party.setIsPrivate(expectedPrivate); |
| 183 | + Boolean actualPrivate = party.getIsPrivate(); |
| 184 | + assertThat(actualPrivate).isEqualTo(expectedPrivate); |
| 185 | + } |
| 186 | + |
| 187 | + @Test |
| 188 | + void testCoverCharge() { |
| 189 | + Party party = |
| 190 | + new Party( |
| 191 | + "Everyday People", |
| 192 | + "Washington D.C.", |
| 193 | + "2025-06-012", |
| 194 | + false, |
| 195 | + 50.0, |
| 196 | + 0, |
| 197 | + Vibe.CHILL, |
| 198 | + new String[] {}); |
| 199 | + Double expectedCharge = 50.0; |
| 200 | + party.setCoverCharge(expectedCharge); |
| 201 | + Double actualCharge = party.getCoverCharge(); |
| 202 | + assertThat(actualCharge).isEqualTo(expectedCharge); |
| 203 | + } |
| 204 | + |
| 205 | + @Test |
| 206 | + void testGetTicketNum() { |
| 207 | + Party party = |
| 208 | + new Party( |
| 209 | + "Everyday People", |
| 210 | + "Washington D.C.", |
| 211 | + "2025-06-012", |
| 212 | + false, |
| 213 | + 50.0, |
| 214 | + 0, |
| 215 | + Vibe.CHILL, |
| 216 | + new String[] {}); |
| 217 | + int expectedNum = 10; |
| 218 | + party.setTicketNumber(expectedNum); |
| 219 | + int actualTicketNumber = party.getTicketNumber(); |
| 220 | + assertThat(actualTicketNumber).isEqualTo(expectedNum); |
| 221 | + } |
| 222 | + |
| 223 | + @Test |
| 224 | + void testSetTicketNum() { |
| 225 | + Party party = |
| 226 | + new Party( |
| 227 | + "Everyday People", |
| 228 | + "Washington D.C.", |
| 229 | + "2025-06-012", |
| 230 | + false, |
| 231 | + 50.0, |
| 232 | + 0, |
| 233 | + Vibe.CHILL, |
| 234 | + new String[] {}); |
| 235 | + int expectedNum = 10; |
| 236 | + party.setTicketNumber(expectedNum); |
| 237 | + int actualTicketNumber = party.getTicketNumber(); |
| 238 | + assertThat(actualTicketNumber).isEqualTo(expectedNum); |
| 239 | + } |
| 240 | + |
| 241 | + @Test |
| 242 | + void testGuestList() { |
| 243 | + Party party = |
| 244 | + new Party( |
| 245 | + "Everyday People", |
| 246 | + "Washington D.C.", |
| 247 | + "2025-06-012", |
| 248 | + false, |
| 249 | + 50.0, |
| 250 | + 0, |
| 251 | + Vibe.CHILL, |
| 252 | + new String[] {}); |
| 253 | + String[] expectedGuestList = {"Meiko", "Ezra", "Bryana", "Justin"}; |
| 254 | + |
| 255 | + ArrayList<String> guestList = new ArrayList<>(Arrays.asList(expectedGuestList)); |
| 256 | + party.setGuestList(guestList); |
| 257 | + |
| 258 | + ArrayList<String> actualGuestList = party.getGuestList(); |
| 259 | + assertThat(actualGuestList).isEqualTo(new ArrayList<>(Arrays.asList(expectedGuestList))); |
| 260 | + } |
| 261 | +} |
0 commit comments