Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct order or arguments to assertEquals call in tests #2831

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,31 @@ public class ClientResourceExceptionTest {
@Test
public void testCodeToString() {

assertEquals("OK", ClientResourceException.codeToString(200));
assertEquals("Created", ClientResourceException.codeToString(201));
assertEquals("Accepted", ClientResourceException.codeToString(202));
assertEquals("No Content", ClientResourceException.codeToString(204));
assertEquals("Moved Permanently", ClientResourceException.codeToString(301));
assertEquals("Found", ClientResourceException.codeToString(302));
assertEquals("See Other", ClientResourceException.codeToString(303));
assertEquals("Not Modified", ClientResourceException.codeToString(304));
assertEquals("Temporary Redirect", ClientResourceException.codeToString(307));
assertEquals("Bad Request", ClientResourceException.codeToString(400));
assertEquals("Unauthorized", ClientResourceException.codeToString(401));
assertEquals("Forbidden", ClientResourceException.codeToString(403));
assertEquals("Not Found", ClientResourceException.codeToString(404));
assertEquals("Conflict", ClientResourceException.codeToString(409));
assertEquals("Gone", ClientResourceException.codeToString(410));
assertEquals("Precondition Failed", ClientResourceException.codeToString(412));
assertEquals("Unsupported Media Type", ClientResourceException.codeToString(415));
assertEquals("Precondition Required", ClientResourceException.codeToString(428));
assertEquals("Too Many Requests", ClientResourceException.codeToString(429));
assertEquals("Request Header Fields Too Large", ClientResourceException.codeToString(431));
assertEquals("Internal Server Error", ClientResourceException.codeToString(500));
assertEquals("Not Implemented", ClientResourceException.codeToString(501));
assertEquals("Service Unavailable", ClientResourceException.codeToString(503));
assertEquals("Network Authentication Required", ClientResourceException.codeToString(511));
assertEquals("1001", ClientResourceException.codeToString(1001));
assertEquals(ClientResourceException.codeToString(200), "OK");
assertEquals(ClientResourceException.codeToString(201), "Created");
assertEquals(ClientResourceException.codeToString(202), "Accepted");
assertEquals(ClientResourceException.codeToString(204), "No Content");
assertEquals(ClientResourceException.codeToString(301), "Moved Permanently");
assertEquals(ClientResourceException.codeToString(302), "Found");
assertEquals(ClientResourceException.codeToString(303), "See Other");
assertEquals(ClientResourceException.codeToString(304), "Not Modified");
assertEquals(ClientResourceException.codeToString(307), "Temporary Redirect");
assertEquals(ClientResourceException.codeToString(400), "Bad Request");
assertEquals(ClientResourceException.codeToString(401), "Unauthorized");
assertEquals(ClientResourceException.codeToString(403), "Forbidden");
assertEquals(ClientResourceException.codeToString(404), "Not Found");
assertEquals(ClientResourceException.codeToString(409), "Conflict");
assertEquals(ClientResourceException.codeToString(410), "Gone");
assertEquals(ClientResourceException.codeToString(412), "Precondition Failed");
assertEquals(ClientResourceException.codeToString(415), "Unsupported Media Type");
assertEquals(ClientResourceException.codeToString(428), "Precondition Required");
assertEquals(ClientResourceException.codeToString(429), "Too Many Requests");
assertEquals(ClientResourceException.codeToString(431), "Request Header Fields Too Large");
assertEquals(ClientResourceException.codeToString(500), "Internal Server Error");
assertEquals(ClientResourceException.codeToString(501), "Not Implemented");
assertEquals(ClientResourceException.codeToString(503), "Service Unavailable");
assertEquals(ClientResourceException.codeToString(511), "Network Authentication Required");
assertEquals(ClientResourceException.codeToString(1001), "1001");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,10 @@ public void testGetTenantResourceGroupRoles() throws Exception {
}

assertNotNull(retRoles);
assertEquals(tenantDomain, retRoles.getTenant());
assertEquals(providerDomain, retRoles.getDomain());
assertEquals(providerService, retRoles.getService());
assertEquals(resourceGroup, retRoles.getResourceGroup());
assertEquals(retRoles.getTenant(), tenantDomain);
assertEquals(retRoles.getDomain(), providerDomain);
assertEquals(retRoles.getService(), providerService);
assertEquals(retRoles.getResourceGroup(), resourceGroup);

// try to get unknown resource group that would return null

Expand Down Expand Up @@ -636,10 +636,10 @@ public void testGetProviderResourceGroupRoles() throws Exception {
}

assertNotNull(retRoles);
assertEquals(tenantDomain, retRoles.getTenant());
assertEquals(providerDomain, retRoles.getDomain());
assertEquals(providerService, retRoles.getService());
assertEquals(resourceGroup, retRoles.getResourceGroup());
assertEquals(retRoles.getTenant(), tenantDomain);
assertEquals(retRoles.getDomain(), providerDomain);
assertEquals(retRoles.getService(), providerService);
assertEquals(retRoles.getResourceGroup(), resourceGroup);

// try to get unknown resource group that would return null

Expand Down Expand Up @@ -671,14 +671,14 @@ public void testGetTemplate() throws Exception {
assertNotNull(solTemplate);
List<Role> solRoles = solTemplate.getRoles();
assertNotNull(solRoles);
assertEquals(1, solRoles.size());
assertEquals("role1", solRoles.get(0).getName());
assertEquals("trust-domain", solRoles.get(0).getTrust());
assertEquals(solRoles.size(), 1);
assertEquals(solRoles.get(0).getName(), "role1");
assertEquals(solRoles.get(0).getTrust(), "trust-domain");

List<Policy> solPolicies = solTemplate.getPolicies();
assertNotNull(solPolicies);
assertEquals(1, solPolicies.size());
assertEquals("policy1", solPolicies.get(0).getName());
assertEquals(solPolicies.size(), 1);
assertEquals(solPolicies.get(0).getName(), "policy1");
}

@Test
Expand All @@ -693,7 +693,7 @@ public void testGetServerTemplateList() throws Exception {

ServerTemplateList solTemplateList = zclt.getServerTemplateList();
assertNotNull(solTemplateList);
assertEquals(2, solTemplateList.getTemplateNames().size());
assertEquals(solTemplateList.getTemplateNames().size(), 2);
assertTrue(solTemplateList.getTemplateNames().contains("mh2"));
assertTrue(solTemplateList.getTemplateNames().contains("vipng"));
}
Expand All @@ -710,7 +710,7 @@ public void testGetDomainTemplateList() throws Exception {

DomainTemplateList domTemplateList = zclt.getDomainTemplateList("iaas.athenz");
assertNotNull(domTemplateList);
assertEquals(2, domTemplateList.getTemplateNames().size());
assertEquals(domTemplateList.getTemplateNames().size(), 2);
assertTrue(domTemplateList.getTemplateNames().contains("mh2"));
assertTrue(domTemplateList.getTemplateNames().contains("vipng"));
}
Expand All @@ -723,8 +723,8 @@ public void testGetPrincipal() throws URISyntaxException, IOException {

Principal principal = zclt.getPrincipal("v=U1;d=coretech;n=storage;s=signature");
assertNotNull(principal);
assertEquals("storage", principal.getName());
assertEquals("coretech", principal.getDomain());
assertEquals(principal.getName(), "storage");
assertEquals(principal.getDomain(), "coretech");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3090,7 +3090,7 @@ public void testGetPrincipalNull() {
client.getPrincipal(null);
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}
client.close();
}
Expand All @@ -3103,21 +3103,21 @@ public void testGetPrincipalInvalid() {
client.getPrincipal("abcdefg");
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

try {
client.getPrincipal("v=U1;d=coretech;t=12345678;s=signature");
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

try {
client.getPrincipal("v=U1;n=storage;t=12345678;s=signature");
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}
client.close();
}
Expand Down Expand Up @@ -3309,7 +3309,7 @@ public void testGetStats() throws URISyntaxException, IOException {
client.getStats("athenz");
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

// last time with std exception
Expand All @@ -3318,7 +3318,7 @@ public void testGetStats() throws URISyntaxException, IOException {
client.getStats("athenz");
fail();
} catch (ZMSClientException ex) {
assertEquals(400, ex.getCode());
assertEquals(ex.getCode(), 400);
}
}

Expand Down Expand Up @@ -3346,7 +3346,7 @@ public void testGetInfo() throws URISyntaxException, IOException {
client.getInfo();
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

// last time with std exception
Expand All @@ -3355,7 +3355,7 @@ public void testGetInfo() throws URISyntaxException, IOException {
client.getInfo();
fail();
} catch (ZMSClientException ex) {
assertEquals(400, ex.getCode());
assertEquals(ex.getCode(), 400);
}
}

Expand All @@ -3382,7 +3382,7 @@ public void testGetQuota() throws URISyntaxException, IOException {
client.getQuota("athenz");
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

// last time with std exception
Expand All @@ -3391,7 +3391,7 @@ public void testGetQuota() throws URISyntaxException, IOException {
client.getQuota("athenz");
fail();
} catch (ZMSClientException ex) {
assertEquals(400, ex.getCode());
assertEquals(ex.getCode(), 400);
}
}

Expand Down Expand Up @@ -3419,7 +3419,7 @@ public void testPutQuota() throws URISyntaxException, IOException {
client.putQuota("athenz", AUDIT_REF, quota);
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

// last time with std exception
Expand All @@ -3428,7 +3428,7 @@ public void testPutQuota() throws URISyntaxException, IOException {
client.putQuota("athenz", AUDIT_REF, quota);
fail();
} catch (ZMSClientException ex) {
assertEquals(400, ex.getCode());
assertEquals(ex.getCode(), 400);
}
}

Expand All @@ -3451,7 +3451,7 @@ public void testDeleteQuota() throws URISyntaxException, IOException {
client.deleteQuota("athenz", AUDIT_REF);
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

// finally std exception
Expand All @@ -3460,7 +3460,7 @@ public void testDeleteQuota() throws URISyntaxException, IOException {
client.deleteQuota("athenz", AUDIT_REF);
fail();
} catch (ZMSClientException ex) {
assertEquals(400, ex.getCode());
assertEquals(ex.getCode(), 400);
}
}

Expand All @@ -3484,7 +3484,7 @@ public void testDeleteDomainRoleMember() throws URISyntaxException, IOException
client.deleteDomainRoleMember("athenz", "athenz.api", AUDIT_REF);
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

// last time with std exception - resulting in 400
Expand All @@ -3493,7 +3493,7 @@ public void testDeleteDomainRoleMember() throws URISyntaxException, IOException
client.deleteDomainRoleMember("athenz", "athenz.api", AUDIT_REF);
fail();
} catch (ZMSClientException ex) {
assertEquals(400, ex.getCode());
assertEquals(ex.getCode(), 400);
}
}

Expand Down Expand Up @@ -3534,7 +3534,7 @@ public void testGetDomainRoleMembers() throws URISyntaxException, IOException {
client.getDomainRoleMembers("athenz");
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

// last time with std exception - resulting in 400
Expand All @@ -3543,7 +3543,7 @@ public void testGetDomainRoleMembers() throws URISyntaxException, IOException {
client.getDomainRoleMembers("athenz");
fail();
} catch (ZMSClientException ex) {
assertEquals(400, ex.getCode());
assertEquals(ex.getCode(), 400);
}
}

Expand Down Expand Up @@ -3584,7 +3584,7 @@ public void testGetDomainGroupMembers() throws URISyntaxException, IOException {
client.getDomainGroupMembers("athenz");
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

// last time with std exception - resulting in 400
Expand All @@ -3593,7 +3593,7 @@ public void testGetDomainGroupMembers() throws URISyntaxException, IOException {
client.getDomainGroupMembers("athenz");
fail();
} catch (ZMSClientException ex) {
assertEquals(400, ex.getCode());
assertEquals(ex.getCode(), 400);
}
}

Expand Down Expand Up @@ -3655,7 +3655,7 @@ public void testGetPrincipalRoles() throws URISyntaxException, IOException {
client.getPrincipalRoles(null, null);
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

// last time with std exception - resulting in 400
Expand All @@ -3664,7 +3664,7 @@ public void testGetPrincipalRoles() throws URISyntaxException, IOException {
client.getPrincipalRoles(null, null);
fail();
} catch (ZMSClientException ex) {
assertEquals(400, ex.getCode());
assertEquals(ex.getCode(), 400);
}
}

Expand Down Expand Up @@ -3794,7 +3794,7 @@ public void testGetAccess() throws URISyntaxException, IOException {
client.getAccess("update", "service1", "athenz", "user.johndoe");
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

// last time with std exception
Expand All @@ -3803,7 +3803,7 @@ public void testGetAccess() throws URISyntaxException, IOException {
client.getAccess("update", "service1", "athenz", "user.johndoe");
fail();
} catch (ZMSClientException ex) {
assertEquals(400, ex.getCode());
assertEquals(ex.getCode(), 400);
}
}

Expand All @@ -3828,7 +3828,7 @@ public void testGetAccessExt() throws URISyntaxException, IOException {
client.getAccessExt("update", "service1", "athenz", "user.johndoe");
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}

// last time with std exception
Expand All @@ -3837,7 +3837,7 @@ public void testGetAccessExt() throws URISyntaxException, IOException {
client.getAccessExt("update", "service1", "athenz", "user.johndoe");
fail();
} catch (ZMSClientException ex) {
assertEquals(400, ex.getCode());
assertEquals(ex.getCode(), 400);
}
}

Expand All @@ -3859,13 +3859,13 @@ public void testGetEntityList() throws URISyntaxException, IOException {
client.getEntityList("athenz");
fail();
} catch (ZMSClientException ex) {
assertEquals(401, ex.getCode());
assertEquals(ex.getCode(), 401);
}
try {
client.getEntityList("athenz");
fail();
} catch (ZMSClientException ex) {
assertEquals(400, ex.getCode());
assertEquals(ex.getCode(), 400);
}
}

Expand Down
Loading
Loading