src/test/java/org/embulk/input/zendesk/clients/TestZendeskRestClient.java in embulk-input-zendesk-0.3.4 vs src/test/java/org/embulk/input/zendesk/clients/TestZendeskRestClient.java in embulk-input-zendesk-0.3.5
- old
+ new
@@ -8,31 +8,23 @@
import org.apache.http.StatusLine;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.entity.StringEntity;
+import org.embulk.EmbulkTestRuntime;
import org.embulk.config.ConfigException;
import org.embulk.config.ConfigSource;
-import org.embulk.input.zendesk.ZendeskInputPlugin;
import org.embulk.input.zendesk.ZendeskInputPlugin.PluginTask;
-import org.embulk.input.zendesk.utils.ZendeskPluginTestRuntime;
import org.embulk.input.zendesk.utils.ZendeskTestHelper;
import org.embulk.input.zendesk.utils.ZendeskUtils;
-import org.embulk.spi.InputPlugin;
-import org.embulk.test.TestingEmbulk;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TestRule;
-
import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
import static org.apache.http.HttpHeaders.AUTHORIZATION;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.fail;
@@ -47,27 +39,21 @@
import java.io.IOException;
import java.util.Optional;
public class TestZendeskRestClient
{
- private final ExpectedException thrown = ExpectedException.none();
- private final TestingEmbulk embulk = TestingEmbulk.builder()
- .registerPlugin(InputPlugin.class, "zendesk", ZendeskInputPlugin.class)
- .build();
- public ZendeskPluginTestRuntime runtime = new ZendeskPluginTestRuntime();
-
- @Rule
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
- public TestRule chain = RuleChain.outerRule(embulk).around(runtime).around(thrown);
+ @Rule
+ public EmbulkTestRuntime embulkTestRuntime = new EmbulkTestRuntime();
private ZendeskRestClient zendeskRestClient;
private PluginTask task = ZendeskTestHelper.getConfigSource("incremental.yml").loadConfig(PluginTask.class);
private JsonNode data = ZendeskTestHelper.getJsonFromFile("data/client.json");
- private HttpClient client = Mockito.mock(HttpClient.class);
- private HttpResponse response = Mockito.mock(HttpResponse.class);
+ private HttpClient client = mock(HttpClient.class);
+ private HttpResponse response = mock(HttpResponse.class);
private Header header = mock(Header.class);
- private StatusLine statusLine = Mockito.mock(StatusLine.class);
+ private StatusLine statusLine = mock(StatusLine.class);
@Before
public void prepare() throws IOException
{
zendeskRestClient = spy(new ZendeskRestClient());