Vereinheitlichung der Tests von DomainOptionen

This commit is contained in:
Timotheus Pokorra 2023-12-12 11:01:19 +01:00
parent fea2612a48
commit 643b23ad34

View File

@ -135,13 +135,12 @@ public class DomainTest {
Map<?, ?> row = (Map<?, ?>) o; Map<?, ?> row = (Map<?, ?>) o;
assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name"))); assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name")));
assertTrue("ValidSubdomainNames should be * but is " + row.get("validsubdomainnames"), "*".equals(row.get("validsubdomainnames"))); assertTrue("ValidSubdomainNames should be * but is " + row.get("validsubdomainnames"), "*".equals(row.get("validsubdomainnames")));
Object[] domainoptions = (Object[]) row.get("domainoptions"); String[] checkDomainOptions = Arrays.asList((Object[]) row.get("domainoptions")).toArray(new String[0]);
String options = ""; String[] expectedDomainOptions = new String[] {"htdocsfallback", "indexes", "dkim", "autoconfig", "greylisting", "includes", "letsencrypt", "multiviews"};
for (Object option: domainoptions) { Arrays.sort(expectedDomainOptions);
options += option + " "; Arrays.sort(checkDomainOptions);
} assertTrue("Domainoptions should be " + Arrays.toString(expectedDomainOptions) + " but are " + Arrays.toString(checkDomainOptions),
String defaultDomainOptions = "htdocsfallback indexes dkim autoconfig greylisting includes letsencrypt multiviews "; Arrays.toString(expectedDomainOptions).equals(Arrays.toString(checkDomainOptions)));
assertTrue("Domainoptions should be " + defaultDomainOptions + " but are " + options, defaultDomainOptions.equals(options));
} }
else { else {
fail("Map<?, ?> expected"); fail("Map<?, ?> expected");
@ -175,8 +174,7 @@ public class DomainTest {
Map<?, ?> row = (Map<?, ?>) o; Map<?, ?> row = (Map<?, ?>) o;
assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name"))); assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name")));
assertTrue("ValidSubdomainNames should be www2 but is " + row.get("validsubdomainnames"), "www2".equals(row.get("validsubdomainnames"))); assertTrue("ValidSubdomainNames should be www2 but is " + row.get("validsubdomainnames"), "www2".equals(row.get("validsubdomainnames")));
Object[] domainoptions = (Object[]) row.get("domainoptions"); String[] checkDomainOptions = Arrays.asList((Object[]) row.get("domainoptions")).toArray(new String[0]);
String[] checkDomainOptions = Arrays.asList(domainoptions).toArray(new String[0]);
Arrays.sort(newDomainOptions); Arrays.sort(newDomainOptions);
Arrays.sort(checkDomainOptions); Arrays.sort(checkDomainOptions);
assertTrue("Domainoptions should be " + Arrays.toString(newDomainOptions) + " but are " + Arrays.toString(checkDomainOptions), assertTrue("Domainoptions should be " + Arrays.toString(newDomainOptions) + " but are " + Arrays.toString(checkDomainOptions),