package com.github.cosmo0920.fluentd.flume.plugins.parser;

import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Matchers;
import static org.mockito.Mockito.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import java.util.Map;
import java.util.HashMap;

import java.io.IOException;

public class TestParser {

	@Test
	public void testJsonParser() {
		String json = "{\"test\":\"message\"}";
		JsonParser parser = new JsonParser();
		Map<String, Object> result = parser.parse(json);
		Map<String, Object> expect = new HashMap<String, Object>();
		expect.put("test", "message");
		assertEquals(expect, result);
	}

	@Test
	public void testPlainTextParser() {
		String eventBody = "test entry";
		PlainTextParser parser = new PlainTextParser();
		Map<String, Object> result = parser.parse(eventBody);
		Map<String, Object> expect = new HashMap<String, Object>();
		expect.put("message", "test entry");
		assertEquals(expect, result);
	}

	@Test
	public void testHierarchy() {
		EventParser textParser = new PlainTextParser();
		EventParser jsonParser = new JsonParser();

		assertTrue(EventParser.class.isInstance(textParser));
		assertTrue(EventParser.class.isInstance(jsonParser));
	}

}

@@ -678,32 +678,34 @@
 , Object%3E expect
+ed
  = new HashMap%3CS
@@ -726,24 +726,26 @@
 ();%0A%09%09expect
+ed
 .put(%22test%22,
@@ -770,32 +770,34 @@
 ertEquals(expect
+ed
 , result);%0A%09%7D%0A%0A%09
@@ -1008,16 +1008,18 @@
 %3E expect
+ed
  = new H
@@ -1052,16 +1052,18 @@
 %09%09expect
+ed
 .put(%22me
@@ -1106,16 +1106,18 @@
 s(expect
+ed
 , result

Fix a typo