@Test
public void testDocMissing() throws Exception {

    ESPushTaskConfig.ESIndexSpec esConfig = getEsIndexSpec("key_avro", false);
    ESPushTask task = getEsPushTask();
    ActionRequestKey inKeyUpdate = ActionRequestKey.newBuilder()
        .setAction(Action.UPDATE)
        .setId("foo")
        .build();
    when(task.avroSerde.fromBytes(null)).thenReturn(inKeyUpdate);
    assertThatThrownBy(() -> task.getAvroKeyOutMsg(getInMsg(null), esConfig)).isInstanceOf(InvalidParameterException.class)
        .hasMessageContaining("Document must be provided");
    ActionRequestKey inKeyIndex = ActionRequestKey.newBuilder()
        .setAction(Action.INDEX)
        .setId("foo")
        .build();
    when(task.avroSerde.fromBytes(null)).thenReturn(inKeyIndex);
    assertThatThrownBy(() -> task.getAvroKeyOutMsg(getInMsg(null), esConfig)).isInstanceOf(InvalidParameterException.class)
        .hasMessageContaining("Document must be provided");
}