@Test
public void testWritesWithToStaticIndex() throws Exception {

    ESPushTaskConfig.ESIndexSpec esConfig = getEsIndexSpec("key_avro", false);
    ESPushTask task = getEsPushTask();
    ActionRequestKey inKeyMissingId = ActionRequestKey.newBuilder()
        .setAction(Action.DELETE)
        .build();
    when(task.avroSerde.fromBytes(null)).thenReturn(inKeyMissingId);
    assertThatThrownBy(() -> task.getAvroKeyOutMsg(getInMsg(""), esConfig)).isInstanceOf(InvalidParameterException.class)
        .hasMessageContaining("Document id is required");
    ActionRequestKey inKey = ActionRequestKey.newBuilder()
        .setAction(Action.UPDATE)
        .setId("blah")
        .build();
    when(task.avroSerde.fromBytes(null)).thenReturn(inKey);
    OutgoingMessageEnvelope out = task.getAvroKeyOutMsg(getInMsg("{}"), esConfig);
    HTTPBulkLoader.ActionRequest req = (HTTPBulkLoader.ActionRequest) out.getMessage();
    assertEquals("blah", req.key.getId().toString());
    assertEquals(Action.UPDATE, req.key.getAction());
    assertNull("Do not default partition time", req.key.getPartitionTsUnixMs());
    assertNull("Do not default event time", req.key.getEventTsUnixMs());
    assertNull("No version set", req.key.getVersion());
    assertNull("No version type set", req.key.getVersionType());
    assertEquals("{\"doc\":{}}", req.document);
}