ImageInteractionsParserObject { @NonNull public EnumSet<DerpibooruImageInteraction.InteractionType> getImageInteractionsForImage(int imageId) { if (mInteractionsByImage.get(imageId) != null) { return mInteractionsByImage.get(imageId); } return EnumSet.noneOf(DerpibooruImageInteraction.InteractionType.class); } ImageInteractionsParserObject(String jsonArray); @NonNull EnumSet<DerpibooruImageInteraction.InteractionType> getImageInteractionsForImage(int imageId);  }
@Test public void testUpvoted() { EnumSet<DerpibooruImageInteraction.InteractionType> interactions = this.interactions.getImageInteractionsForImage(1100271); EnumSet expected = EnumSet.of(DerpibooruImageInteraction.InteractionType.Upvote); assertThat(interactions, is(expected)); }
@Test public void testDownvoted() { EnumSet<DerpibooruImageInteraction.InteractionType> interactions = this.interactions.getImageInteractionsForImage(82342); EnumSet expected = EnumSet.of(DerpibooruImageInteraction.InteractionType.Downvote); assertThat(interactions, is(expected)); }
@Test public void testEmpty() { EnumSet<DerpibooruImageInteraction.InteractionType> interactions = this.interactions.getImageInteractionsForImage(-1); EnumSet expected = EnumSet.noneOf(DerpibooruImageInteraction.InteractionType.class); assertThat(interactions, is(expected)); }
@Test public void testFavedAndUpvoted() { EnumSet<DerpibooruImageInteraction.InteractionType> interactions = this.interactions.getImageInteractionsForImage(1100009); EnumSet expected = EnumSet.of(DerpibooruImageInteraction.InteractionType.Fave, DerpibooruImageInteraction.InteractionType.Upvote); assertThat(interactions, is(expected)); }
@Test public void testFaved() { EnumSet<DerpibooruImageInteraction.InteractionType> interactions = this.interactions.getImageInteractionsForImage(50234); EnumSet expected = EnumSet.of(DerpibooruImageInteraction.InteractionType.Fave); assertThat(interactions, is(expected)); }