Skip to content

Commit

Permalink
Merge pull request #39 from arquillian/master
Browse files Browse the repository at this point in the history
Add new exceptional tests (arquillian#541)
  • Loading branch information
kifj committed Mar 19, 2024
2 parents 5217897 + e8f2aee commit 38dea12
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
Expand Up @@ -468,6 +468,16 @@ public String get() {
});
}

@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionIfDescriptorIsNull() {
new PropertiesParser().addProperties(null, System.getProperties());
}

@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionIfPropertiesIsNull() {
new PropertiesParser().addProperties(desc, null);
}

private void validate(String property, String value, ValueCallback callback) {
validate(property, value, value, callback);
}
Expand Down
Expand Up @@ -121,6 +121,16 @@ public void shouldThrowExceptionOnMissingNamedTargetedContext() throws Exception
handler.locateTestServlet(testMethod);
}

@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionWhenNoConfig() throws Exception {
new ServletURIHandler(null, to(new HTTPContext("127.0.0.1", 8080).add(new Servlet(ServletMethodExecutor.ARQUILLIAN_SERVLET_NAME, "test"))));
}

@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionOnNoContexts() throws Exception {
new ServletURIHandler(new ServletProtocolConfiguration(), null);
}

private Collection<HTTPContext> to(HTTPContext... inputs) {
List<HTTPContext> contexts = new ArrayList<HTTPContext>();
Collections.addAll(contexts, inputs);
Expand Down
Expand Up @@ -103,4 +103,25 @@ public void shouldDisableCommandService() throws Exception {
"Timeout exception should have been thrown",
result.getThrowable().getMessage().contains("timeout"));
}

@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionIfNoConfig() throws Exception {
new ServletMethodExecutor(null, createContexts(), new TestCommandCallback());
}

@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionIfNoContexts() {
new ServletMethodExecutor(new ServletProtocolConfiguration(), null, new TestCommandCallback());
}

@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionIfNoCallback() throws Exception {
new ServletMethodExecutor(new ServletProtocolConfiguration(), createContexts(), null);
}

@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionIfNoExecutor() throws Exception {
ServletMethodExecutor executor = new ServletMethodExecutor(new ServletProtocolConfiguration(), createContexts(), new TestCommandCallback());
executor.invoke(null);
}
}
Expand Up @@ -302,6 +302,11 @@ public void shouldThrowExceptionOnEnterpriseArchiveWithMultipleMarkedWebArchives
processors());
}

@Test(expected = IllegalArgumentException.class)
public void shouldVerifyExceptionOnEmptyVersion() throws Exception {
Descriptors.create(WebAppDescriptor.class).version("");
}

private Collection<Archive<?>> createAuxiliaryArchives() {
List<Archive<?>> archives = new ArrayList<Archive<?>>();
archives.add(ShrinkWrap.create(JavaArchive.class, "auxiliaryArchive1.jar"));
Expand Down

0 comments on commit 38dea12

Please sign in to comment.