Skip to content

Commit

Permalink
Renamed tests; Removed unnecessary casts
Browse files Browse the repository at this point in the history
Signed-off-by: David Powers <[email protected]>
  • Loading branch information
David Powers committed Jan 3, 2022
1 parent 415a8b4 commit 95d3350
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.amazon.dataprepper.model.record.Record;
import org.junit.jupiter.api.Test;

import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
Expand All @@ -20,6 +21,7 @@

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.CoreMatchers.is;

public class DropEventsProcessorTests {
private String messageInput;
Expand All @@ -28,7 +30,7 @@ public class DropEventsProcessorTests {
private final String PLUGIN_NAME = "drop_events";

@Test
void doExecute() {
void testSingleMessageToDropProcessor() {
pluginSetting = getDefaultPluginSetting();
pluginSetting.setPipelineName("dropProcessorPipeline");
dropProcessor = new DropEventsProcessor(pluginSetting);
Expand All @@ -38,13 +40,13 @@ void doExecute() {
testData.put("message", messageInput);
final Record<Event> record = buildRecordWithEvent(testData);

final List<Record<Event>> droppedRecords = (List<Record<Event>>) dropProcessor.doExecute(Collections.singletonList(record));
final Collection<Record<Event>> droppedRecords = dropProcessor.doExecute(Collections.singletonList(record));

assertThat(droppedRecords.size(), equalTo(0));
}

@Test
void doExecuteMulti() {
void testMultipleMessagesToDropProcessor() {
pluginSetting = getDefaultPluginSetting();
pluginSetting.setPipelineName("dropProcessorPipeline");
dropProcessor = new DropEventsProcessor(pluginSetting);
Expand All @@ -62,11 +64,20 @@ void doExecuteMulti() {
multiSet.add(record);
multiSet.add(record2);

final List<Record<Event>> droppedRecords = (List<Record<Event>>) dropProcessor.doExecute(multiSet);
final Collection<Record<Event>> droppedRecords = dropProcessor.doExecute(multiSet);

assertThat(droppedRecords.size(), equalTo(0));
}

@Test
void testShutdownIsReady() {
pluginSetting = getDefaultPluginSetting();
pluginSetting.setPipelineName("dropProcessorPipeline");
dropProcessor = new DropEventsProcessor(pluginSetting);

assertThat(dropProcessor.isReadyForShutdown(), is(true));
}

private PluginSetting getDefaultPluginSetting() {
final Map<String, Object> settings = new HashMap<>();
return new PluginSetting(PLUGIN_NAME, settings);
Expand Down

0 comments on commit 95d3350

Please sign in to comment.