fix tests

This commit is contained in:
Benjamin Gamard 2018-11-01 16:40:55 +01:00
parent 4ebf621e11
commit a75b40bbfb

View File

@ -56,7 +56,7 @@ public class TestAuditLogResource extends BaseJerseyTest {
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, auditlog1Token) .cookie(TokenBasedSecurityFilter.COOKIE_NAME, auditlog1Token)
.get(JsonObject.class); .get(JsonObject.class);
JsonArray logs = json.getJsonArray("logs"); JsonArray logs = json.getJsonArray("logs");
Assert.assertTrue(logs.size() == 3); Assert.assertEquals(3, logs.size());
Assert.assertEquals(countByClass(logs, "Document"), 1); Assert.assertEquals(countByClass(logs, "Document"), 1);
Assert.assertEquals(countByClass(logs, "Acl"), 2); Assert.assertEquals(countByClass(logs, "Acl"), 2);
Assert.assertEquals("auditlog1", logs.getJsonObject(0).getString("username")); Assert.assertEquals("auditlog1", logs.getJsonObject(0).getString("username"));
@ -73,7 +73,7 @@ public class TestAuditLogResource extends BaseJerseyTest {
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, auditlog1Token) .cookie(TokenBasedSecurityFilter.COOKIE_NAME, auditlog1Token)
.get(JsonObject.class); .get(JsonObject.class);
logs = json.getJsonArray("logs"); logs = json.getJsonArray("logs");
Assert.assertTrue(logs.size() == 2); Assert.assertEquals(2, logs.size());
Assert.assertEquals(countByClass(logs, "Document"), 1); Assert.assertEquals(countByClass(logs, "Document"), 1);
Assert.assertEquals(countByClass(logs, "Tag"), 1); Assert.assertEquals(countByClass(logs, "Tag"), 1);
@ -88,7 +88,7 @@ public class TestAuditLogResource extends BaseJerseyTest {
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, auditlog1Token) .cookie(TokenBasedSecurityFilter.COOKIE_NAME, auditlog1Token)
.get(JsonObject.class); .get(JsonObject.class);
logs = json.getJsonArray("logs"); logs = json.getJsonArray("logs");
Assert.assertTrue(logs.size() == 3); Assert.assertEquals(3, logs.size());
Assert.assertEquals(countByClass(logs, "Document"), 1); Assert.assertEquals(countByClass(logs, "Document"), 1);
Assert.assertEquals(countByClass(logs, "Tag"), 2); Assert.assertEquals(countByClass(logs, "Tag"), 2);
@ -105,7 +105,7 @@ public class TestAuditLogResource extends BaseJerseyTest {
json = target().path("/document/" + document1Id).request() json = target().path("/document/" + document1Id).request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, auditlog1Token) .cookie(TokenBasedSecurityFilter.COOKIE_NAME, auditlog1Token)
.get(JsonObject.class); .get(JsonObject.class);
Assert.assertEquals(update1Date, json.getJsonNumber("update_date").longValue()); Assert.assertTrue(json.getJsonNumber("update_date").longValue() > update1Date); // Adding a file to a document updates it
// Get all logs for the document // Get all logs for the document
json = target().path("/auditlog") json = target().path("/auditlog")