Skip to content

Commit

Permalink
✅ Add test for exception
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Fihlon <[email protected]>
  • Loading branch information
McPringle committed Nov 5, 2024
1 parent 17dec59 commit efb44d0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
Expand All @@ -37,9 +38,10 @@ void getStatuses() throws MastodonException {
}

@Test
@Disabled
void throwException() {
assertThrows(MastodonException.class, () -> new DefaultMastodonLoader().getStatuses("non.existent.server", "java"));
final var exception = assertThrows(MastodonException.class,
() -> new DefaultMastodonLoader().getStatuses("non.existent.server", "java"));
assertEquals("Unable to load posts with hashtag 'java' from Mastodon instance 'non.existent.server'", exception.getMessage());
}

}

0 comments on commit efb44d0

Please sign in to comment.