Skip to content

Commit

Permalink
✅ add test for exception while parsing speakers
Browse files Browse the repository at this point in the history
  • Loading branch information
McPringle committed Nov 14, 2024
1 parent 775fb75 commit 7e3546c
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void getSessions() {
}

@Test
void parseExceptionHandling() {
void parseExceptionSessions() {
final var configuration = mock(Configuration.class);
final var sessionizeConfig = new SessionizeConfig("1",
"file:src/test/resources/sessionize-broken.json?eventId=%s",
Expand All @@ -100,4 +100,17 @@ void parseExceptionHandling() {
final var sessionizePlugin = new SessionizePlugin(configuration);
assertThrows(SessionImportException.class, sessionizePlugin::getSessions);
}

@Test
void parseExceptionSpeakers() {
final var configuration = mock(Configuration.class);
final var sessionizeConfig = new SessionizeConfig("1",
"file:src/test/resources/sessionize.json?eventId=%s",
"file:src/test/resources/sessionize-speakers-broken.json?eventId=%s");
when(configuration.getSessionize()).thenReturn(sessionizeConfig);

final var sessionizePlugin = new SessionizePlugin(configuration);
final var exception = assertThrows(SessionImportException.class, sessionizePlugin::getSessions);
assertTrue(exception.getMessage().startsWith("Error parsing speaker"));
}
}
47 changes: 47 additions & 0 deletions src/test/resources/sessionize-speakers-broken.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[
{
"id": "e5da722a-b022-4556-b665-467e54baf9f4",
"fullName": "Walter White",
"profilePicture": "https://foo.bar/e5da722a-b022-4556-b665-467e54baf9f4.png"
},
{
"id": "2c9d3dc1-9f79-457f-b4b3-42ce42f6366a",
"fullName": "Jesse Pinkman",
"profilePicture": "https://foo.bar/2c9d3dc1-9f79-457f-b4b3-42ce42f6366a.png"
},
{
"id": "3ef92880-b80a-4305-b75c-35650d1259c8",
"fullName": "Gustavo Fring"
"profilePicture": "https://foo.bar/3ef92880-b80a-4305-b75c-35650d1259c8.png"
},
{
"id": "594c1b9a-bdfc-4d02-8045-65aa91a234ab",
"fullName": "Hank Schrader",
"profilePicture": "https://foo.bar/594c1b9a-bdfc-4d02-8045-65aa91a234ab.png"
},
{
"id": "03415469-efed-4fde-b98c-b0e2db6225e7",
"fullName": "Saul Goodman",
"profilePicture": "https://foo.bar/03415469-efed-4fde-b98c-b0e2db6225e7.png"
},
{
"id": "0ad4f2e3-36c6-4093-b492-8098fa7e5560",
"fullName": "Mike Ehrmantraut",
"profilePicture": "https://foo.bar/0ad4f2e3-36c6-4093-b492-8098fa7e5560.png"
},
{
"id": "2f4018fc-6f1a-484c-9297-383fb1a5c4ae",
"fullName": "Skyler White",
"profilePicture": "https://foo.bar/2f4018fc-6f1a-484c-9297-383fb1a5c4ae.png"
},
{
"id": "08aa10d6-848f-4458-80a8-f499295bd560",
"fullName": "Marie Schrader",
"profilePicture": "https://foo.bar/08aa10d6-848f-4458-80a8-f499295bd560.png"
},
{
"id": "4c1405e6-d193-49ff-b592-045adbf7f6fb",
"fullName": "Lydia Rodarte-Quayle",
"profilePicture": "https://foo.bar/4c1405e6-d193-49ff-b592-045adbf7f6fb.png"
}
]

0 comments on commit 7e3546c

Please sign in to comment.