@Test
  public void testUDPSendWholeFlowFile() {
    runner.setProperty(PutSplunk.PROTOCOL, PutSplunk.UDP_VALUE.getValue());
    final String message = "This is one message, should send the whole FlowFile";

    runner.enqueue(message);
    runner.run(1);
    runner.assertAllFlowFilesTransferred(PutSplunk.REL_SUCCESS, 1);

    final MockFlowFile mockFlowFile =
        runner.getFlowFilesForRelationship(PutSplunk.REL_SUCCESS).get(0);
    mockFlowFile.assertContentEquals(message);

    Assert.assertEquals(1, sender.getMessages().size());
    Assert.assertEquals(message, sender.getMessages().get(0));
  }
  @Test
  public void testCompletingPreviousBatchOnNextExecution() {
    runner.setProperty(PutSplunk.PROTOCOL, PutSplunk.UDP_VALUE.getValue());

    final String message = "This is one message, should send the whole FlowFile";

    runner.enqueue(message);
    runner.run(2, false); // don't shutdown to prove that next onTrigger complete previous batch
    runner.assertAllFlowFilesTransferred(PutSplunk.REL_SUCCESS, 1);

    final MockFlowFile mockFlowFile =
        runner.getFlowFilesForRelationship(PutSplunk.REL_SUCCESS).get(0);
    mockFlowFile.assertContentEquals(message);

    Assert.assertEquals(1, sender.getMessages().size());
    Assert.assertEquals(message, sender.getMessages().get(0));
  }
  @Test
  public void testUDPSendDelimitedMessages() {
    runner.setProperty(PutSplunk.PROTOCOL, PutSplunk.UDP_VALUE.getValue());

    final String delimiter = "DD";
    runner.setProperty(PutSplunk.MESSAGE_DELIMITER, delimiter);

    final String message = "This is message 1DDThis is message 2DDThis is message 3";

    runner.enqueue(message);
    runner.run(1);
    runner.assertAllFlowFilesTransferred(PutSplunk.REL_SUCCESS, 1);

    final MockFlowFile mockFlowFile =
        runner.getFlowFilesForRelationship(PutSplunk.REL_SUCCESS).get(0);
    mockFlowFile.assertContentEquals(message);

    Assert.assertEquals(3, sender.getMessages().size());
    Assert.assertEquals("This is message 1", sender.getMessages().get(0));
    Assert.assertEquals("This is message 2", sender.getMessages().get(1));
    Assert.assertEquals("This is message 3", sender.getMessages().get(2));
  }