@Test public void testEmotionJSON() throws Exception { final JSON expected = new JSON(); expected.addValues("valence", Lists.newArrayList( new YearAndValue(1910, 0.4f), new YearAndValue(1930, 0.7f))); expected.addValues("arousal", Lists.newArrayList( new YearAndValue(1910, 0.5f), new YearAndValue(1930, -3f))); expected.addValues("dominance", Lists.newArrayList( new YearAndValue(1910, 6f), new YearAndValue(1930, 5.55f))); final Map<String, Object> actual = Server.getEmotionJson(db, CORPUS, "bar"); assertEquals(expected.data.get("xs"), actual.get("xs")); assertEquals(((List<?>) expected.data.get("columns")).get(0), ((List<?>) actual.get("columns")).get(0)); }
static final Map<String, Object> getEmotionJson(final DatabaseService db, final String corpus, final String word) throws Exception { final JSON data = new JSON(); final Map<String, List<YearAndValue>> emotion = db.getEmotion(corpus, word); for (final String s : emotion.keySet()) data.addValues(s, emotion.get(s)); return data.data; }
Server { static final Map<String, Object> getEmotionJson(final DatabaseService db, final String corpus, final String word) throws Exception { final JSON data = new JSON(); final Map<String, List<YearAndValue>> emotion = db.getEmotion(corpus, word); for (final String s : emotion.keySet()) data.addValues(s, emotion.get(s)); return data.data; } }
Server { static final Map<String, Object> getEmotionJson(final DatabaseService db, final String corpus, final String word) throws Exception { final JSON data = new JSON(); final Map<String, List<YearAndValue>> emotion = db.getEmotion(corpus, word); for (final String s : emotion.keySet()) data.addValues(s, emotion.get(s)); return data.data; }  }
Server { static final Map<String, Object> getEmotionJson(final DatabaseService db, final String corpus, final String word) throws Exception { final JSON data = new JSON(); final Map<String, List<YearAndValue>> emotion = db.getEmotion(corpus, word); for (final String s : emotion.keySet()) data.addValues(s, emotion.get(s)); return data.data; }  static void startErrorServer(final Configuration config, final ArrayList<String> messageParts); static void startServer(final DatabaseService db, final Configuration config, boolean onlyExternal); static void stopServer(); }
Server { static final Map<String, Object> getEmotionJson(final DatabaseService db, final String corpus, final String word) throws Exception { final JSON data = new JSON(); final Map<String, List<YearAndValue>> emotion = db.getEmotion(corpus, word); for (final String s : emotion.keySet()) data.addValues(s, emotion.get(s)); return data.data; }  static void startErrorServer(final Configuration config, final ArrayList<String> messageParts); static void startServer(final DatabaseService db, final Configuration config, boolean onlyExternal); static void stopServer();  }