use of org.elasticsearch.ResourceNotFoundException in project elasticsearch by elastic.
the class StoredScriptTests method testInvalidDelete.
public void testInvalidDelete() {
ResourceNotFoundException rnfe = expectThrows(ResourceNotFoundException.class, () -> ScriptMetaData.deleteStoredScript(null, "test", "lang"));
assertThat(rnfe.getMessage(), equalTo("stored script [test] using lang [lang] does not exist and cannot be deleted"));
rnfe = expectThrows(ResourceNotFoundException.class, () -> ScriptMetaData.deleteStoredScript(null, "test", null));
assertThat(rnfe.getMessage(), equalTo("stored script [test] does not exist and cannot be deleted"));
}
use of org.elasticsearch.ResourceNotFoundException in project elasticsearch by elastic.
the class PercolateQueryBuilderTests method testIndexedDocumentDoesNotExist.
public void testIndexedDocumentDoesNotExist() throws IOException {
indexedDocumentExists = false;
PercolateQueryBuilder pqb = doCreateTestQueryBuilder(true);
ResourceNotFoundException e = expectThrows(ResourceNotFoundException.class, () -> pqb.rewrite(createShardContext()));
String expectedString = "indexed document [" + indexedDocumentIndex + "/" + indexedDocumentType + "/" + indexedDocumentId + "] couldn't be found";
assertThat(e.getMessage(), equalTo(expectedString));
}
Aggregations