@Test public void testConvertToMap() { Map<String, Object> properties = event.toMap(); Assert.assertEquals(properties.get(Event.FieldLabels.when.name()), 1L); Assert.assertEquals(properties.get(Event.FieldLabels.data.name()), "2"); Assert.assertEquals(properties.get(Event.FieldLabels.tags.name()), "3"); Assert.assertEquals(properties.get(Event.FieldLabels.what.name()), "4"); }
public Map<String, Object> toMap() { return new HashMap<String, Object>() { { put(FieldLabels.when.name(), getWhen()); put(FieldLabels.what.name(), getWhat()); put(FieldLabels.data.name(), getData()); put(FieldLabels.tags.name(), getTags()); } }; }
Event { public Map<String, Object> toMap() { return new HashMap<String, Object>() { { put(FieldLabels.when.name(), getWhen()); put(FieldLabels.what.name(), getWhat()); put(FieldLabels.data.name(), getData()); put(FieldLabels.tags.name(), getTags()); } }; } }
Event { public Map<String, Object> toMap() { return new HashMap<String, Object>() { { put(FieldLabels.when.name(), getWhen()); put(FieldLabels.what.name(), getWhat()); put(FieldLabels.data.name(), getData()); put(FieldLabels.tags.name(), getTags()); } }; } Event(); @VisibleForTesting  Event(long when, String what); }
Event { public Map<String, Object> toMap() { return new HashMap<String, Object>() { { put(FieldLabels.when.name(), getWhen()); put(FieldLabels.what.name(), getWhat()); put(FieldLabels.data.name(), getData()); put(FieldLabels.tags.name(), getTags()); } }; } Event(); @VisibleForTesting  Event(long when, String what); Map<String, Object> toMap(); long getWhen(); void setWhen(long when); String getWhat(); void setWhat(String what); String getData(); void setData(String data); String getTags(); void setTags(String tags); }
Event { public Map<String, Object> toMap() { return new HashMap<String, Object>() { { put(FieldLabels.when.name(), getWhen()); put(FieldLabels.what.name(), getWhat()); put(FieldLabels.data.name(), getData()); put(FieldLabels.tags.name(), getTags()); } }; } Event(); @VisibleForTesting  Event(long when, String what); Map<String, Object> toMap(); long getWhen(); void setWhen(long when); String getWhat(); void setWhat(String what); String getData(); void setData(String data); String getTags(); void setTags(String tags); static final String untilParameterName; static final String fromParameterName; static final String tagsParameterName; }