static Map<String, Object> addTag(Map<String, Object> e, List<Object> tags) {
        Event tempEvent = new org.logstash.Event(e);
        addTag(tempEvent, tags);
        return tempEvent.getData();
    }
@Test
    public void testAddTag() {

        // add tag to empty event
        Event e = new Event();
        String testTag = "test_tag";
        CommonActions.addTag(e, Collections.singletonList(testTag));
        Object value = e.getField(TAGS);
        Assert.assertTrue(value instanceof List);
        Assert.assertEquals(1, ((List) value).size());
        Assert.assertEquals(testTag, ((List) value).get(0));

        // add two tags to empty event
        e = new Event();
        String testTag2 = "test_tag2";
        CommonActions.addTag(e, Arrays.asList(testTag, testTag2));
        value = e.getField(TAGS);
        Assert.assertTrue(value instanceof List);
        Assert.assertEquals(2, ((List) value).size());
        Assert.assertEquals(testTag, ((List) value).get(0));
        Assert.assertEquals(testTag2, ((List) value).get(1));

        // add duplicate tag
        e = new Event();
        e.tag(testTag);
        CommonActions.addTag(e, Collections.singletonList(testTag));
        value = e.getField(TAGS);
        Assert.assertTrue(value instanceof List);
        Assert.assertEquals(1, ((List) value).size());
        Assert.assertEquals(testTag, ((List) value).get(0));

        // add dynamically-named tag
        e = new Event(Collections.singletonMap(testTag, testTag2));
        CommonActions.addTag(e, Collections.singletonList("%{" + testTag + "}_foo"));
        value = e.getField(TAGS);
        Assert.assertTrue(value instanceof List);
        Assert.assertEquals(1, ((List) value).size());
        Assert.assertEquals(testTag2 + "_foo", ((List) value).get(0));

        // add non-string tag
        e = new Event();
        Long nonStringTag = 42L;
        CommonActions.addTag(e, Collections.singletonList(nonStringTag));
        value = e.getField(TAGS);
        Assert.assertTrue(value instanceof List);
        Assert.assertEquals(1, ((List) value).size());
        Assert.assertEquals(nonStringTag.toString(), ((List) value).get(0));
    }