EmojisResource { @GET @Path("icons") @Produces(MediaType.APPLICATION_JSON) public EmojiMap getEmojiIcons() { LOG.debug("Got request for icons"); return new EmojiMap(chatApiDao.getEmojis(), unicodeEmojis); } EmojisResource(ChatAlyticsConfig config); @VisibleForTesting protected  EmojisResource(ChatAlyticsConfig config, IChatApiDAO chatApiDao); @GET @Path("trending") @Produces(MediaType.APPLICATION_JSON) Map<String, Long> getTopEmojis(@QueryParam(START_TIME) String startTimeStr,
                                          @QueryParam(END_TIME) String endTimeStr,
                                          @QueryParam(USER) List<String> users,
                                          @QueryParam(ROOM) List<String> rooms,
                                          @QueryParam(TOP_N) String topNStr,
                                          @QueryParam(BOT) String botStr); @GET @Produces(MediaType.APPLICATION_JSON) List<EmojiEntity> getAllEmojis(@QueryParam(START_TIME) String startTimeStr,
                                          @QueryParam(END_TIME) String endTimeStr,
                                          @QueryParam(USER) List<String> users,
                                          @QueryParam(ROOM) List<String> rooms,
                                          @QueryParam(BOT) String botStr); @GET @Path("similarities") @Produces(MediaType.APPLICATION_JSON) LabeledDenseMatrix<String> getSimilarities(
            @QueryParam(START_TIME) String startTimeStr,
            @QueryParam(END_TIME) String endTimeStr,
            @QueryParam(FIRST_SIMILARITY_DIM) String firstDimStr,
            @QueryParam(SECOND_SIMILARITY_DIM) String secondDimStr,
            @QueryParam(BOT) String botStr); @GET @Path("active") @Produces(MediaType.APPLICATION_JSON) Map<String, Double> getActive(@QueryParam(START_TIME) String startTimeStr,
                                         @QueryParam(END_TIME) String endTimeStr,
                                         @QueryParam(DIM) String dimensionStr,
                                         @QueryParam(METHOD) String methodStr,
                                         @QueryParam(TOP_N) String topNStr,
                                         @QueryParam(BOT) String botStr); @GET @Path("icons") @Produces(MediaType.APPLICATION_JSON) EmojiMap getEmojiIcons(); static final String EMOJI_ENDPOINT; static final String FIRST_SIMILARITY_DIM; static final String SECOND_SIMILARITY_DIM; static final String DIM; static final String METHOD; }
@Test public void testGetEmojiIcons() { Map<String, String> emojis = ImmutableMap.of("emoji1", "http: "emoji2", "http: when(chatApiDao.getEmojis()).thenReturn(emojis); EmojiMap result = underTest.getEmojiIcons(); assertEquals(emojis, result.getCustomEmojis()); assertNotNull(result.getUnicodeEmojis()); ObjectMapper objectMapper = JsonObjectMapperFactory.createObjectMapper(); Map<String, String> expectedUnicodeEmojis = LocalEmojiUtils.getUnicodeEmojis(objectMapper); assertEquals(expectedUnicodeEmojis, result.getUnicodeEmojis()); }