+
+ @Test
+ public void testImplNegCases() throws IOException {
+ ElkConnectorImpl impl = new ElkConnectorImpl();
+ Map<String, String> filter = new HashMap<String, String>();
+ assertThatThrownBy(() -> impl.isType(PolicyIndexType.config)).isInstanceOf(IOException.class);
+ assertThatThrownBy(() -> impl.isIndex()).isInstanceOf(IOException.class);
+ assertThatThrownBy(() -> impl.search(null, null)).isInstanceOf(IllegalArgumentException.class);
+ assertThatThrownBy(() -> impl.search(null, "")).isInstanceOf(IllegalArgumentException.class);
+ assertThatThrownBy(() -> impl.search(null, ";;;")).isInstanceOf(IllegalArgumentException.class);
+ assertThatThrownBy(() -> impl.search(null, "foo")).isInstanceOf(IllegalStateException.class);
+ assertThatThrownBy(() -> impl.search(PolicyIndexType.all, "foo")).isInstanceOf(IllegalStateException.class);
+
+ assertThatThrownBy(() -> impl.search(null, null, null)).isInstanceOf(IllegalArgumentException.class);
+ assertThatThrownBy(() -> impl.search(null, null, filter)).isInstanceOf(IllegalArgumentException.class);
+ filter.put("key", "value");
+ assertThatThrownBy(() -> impl.search(null, ";;;", filter)).isInstanceOf(IllegalArgumentException.class);
+ assertThatThrownBy(() -> impl.search(null, "foo", filter)).isInstanceOf(IllegalStateException.class);
+ assertThatThrownBy(() -> impl.search(PolicyIndexType.config, "foo", filter))
+ .isInstanceOf(IllegalStateException.class);
+
+ PolicyRestAdapter adapter = new PolicyRestAdapter();
+ adapter.setNewFileName("scope.Decision_newFile");
+ adapter.setConfigPolicyType("Config");
+ assertThatThrownBy(() -> impl.put(adapter)).isInstanceOf(IOException.class);
+ assertThatThrownBy(() -> impl.delete(adapter)).isInstanceOf(IllegalStateException.class);
+ }