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

import java.nio.charset.StandardCharsets;

import org.apache.flume.Sink.Status;
import org.apache.flume.Channel;
import org.apache.flume.Event;
import org.apache.flume.Transaction;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Matchers;
import 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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TestFluentdSink {
}

@@ -227,16 +227,161 @@
 action;%0A
+import org.apache.flume.EventDeliveryException;%0A%0Aimport org.komamitsu.fluency.Fluency;%0A%0Aimport static org.junit.Assert.*;%0Aimport org.junit.Test;%0A
 import o
@@ -405,16 +405,16 @@
 unWith;%0A
-
 import o
@@ -468,32 +468,39 @@
 atchers;%0Aimport 
+static 
 org.mockito.Mock
@@ -700,16 +700,40 @@
 ctory;%0A%0A
+import java.util.List;%0A%0A
 public c
@@ -755,10 +755,751 @@
 dSink %7B%0A
+%09private static final Logger logger = LoggerFactory.getLogger(FluentdSink.class);%0A%0A%09@Test%0A%09public void testShouldCommitSuccessfulTransaction() throws EventDeliveryException %7B%0A%09%09Channel mockChannel = mock(Channel.class);%0A%09%09Transaction mockTransaction = mock(Transaction.class);%0A%09%09Event mockEvent = mock(Event.class);%0A%0A%09%09when(mockChannel.getTransaction()).thenReturn(mockTransaction);%0A%09%09when(mockChannel.take()).thenReturn(mockEvent);%0A%09%09when(mockEvent.getBody()).thenReturn(%22test body%22.getBytes(StandardCharsets.UTF_8));%0A%0A%09%09FluentdSink sink = new FluentdSink();%0A%09%09sink.setChannel(mockChannel);%0A%0A%09%09// TODO: Extract Fluency sender and mock it%0A%09%09assertTrue(true);%0A%09%09// Status status = sink.process();%0A%09%09// assertEquals(status, Status.READY);%0A%09%7D%0A%0A
 %7D%0A

Write test case skeleton with mockito and junit