@Test
public void searchTest() {

    JestResult r1 = null, r2 = null, r3 = null, r4 = null;
    // Should always work if the above test passes and ELK server is up
    try {
        r1 = new ElkConnectorImpl().search(PolicyIndexType.decision, "abc123");
    } catch (Exception e) {
        // ELK server is down. Don't continue the test
        if (e instanceof IllegalStateException) {
            return;
        }
        fail();
    }
    // Should always work
    try {
        r2 = new ElkConnectorImpl().search(PolicyIndexType.decision, "The_quick_brown_fox_jumps_over_the_lazy_dog");
    } catch (Exception e) {
        fail();
    }
    // Should throw exception
    try {
        r3 = new ElkConnectorImpl().search(PolicyIndexType.decision, "abc123{}");
    } catch (Exception e) {
        if (!(e instanceof IllegalArgumentException)) {
            fail();
        }
    }
    // Should throw exception
    try {
        r4 = new ElkConnectorImpl().search(PolicyIndexType.decision, "The quick brown fox jumps over the lazy dog");
    } catch (Exception e) {
        if (!(e instanceof IllegalArgumentException)) {
            fail();
        }
    }
    assertNotNull(r1);
    assertNotNull(r2);
    assertNull(r3);
    assertNull(r4);
}