Skip to content

Commit

Permalink
integ test checks error message
Browse files Browse the repository at this point in the history
Signed-off-by: jowg-amazon <jowg@amazon.com>
  • Loading branch information
jowg-amazon committed Aug 31, 2023
1 parent e923df9 commit 2e1e6e7
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,12 @@ public void testCreateDetectorWithoutRules() throws IOException {

Detector detector = randomDetector(Collections.emptyList());

expectThrows(ResponseException.class, () -> {
try {
makeRequest(client(), "POST", SecurityAnalyticsPlugin.DETECTOR_BASE_URI, Collections.emptyMap(), toHttpEntity(detector));
});
} catch (ResponseException ex) {
Assert.assertEquals(400, ex.getResponse().getStatusLine().getStatusCode());
assertTrue(ex.getMessage().contains("Detector cannot be created as no compatible rules were provided"));
}
}

public void testCreateDetectorWithIncompatibleDetectorType() throws IOException {
Expand All @@ -344,9 +347,12 @@ public void testCreateDetectorWithIncompatibleDetectorType() throws IOException

Detector detector = randomDetector(getPrePackagedRules("ad_ldap"));

expectThrows(ResponseException.class, () -> {
try {
makeRequest(client(), "POST", SecurityAnalyticsPlugin.DETECTOR_BASE_URI, Collections.emptyMap(), toHttpEntity(detector));
});
} catch (ResponseException ex) {
Assert.assertEquals(400, ex.getResponse().getStatusLine().getStatusCode());
assertTrue(ex.getMessage().contains("Detector cannot be created as no compatible rules were provided"));
}
}

public void testGettingADetector() throws IOException {
Expand Down

0 comments on commit 2e1e6e7

Please sign in to comment.