diff --git a/core/src/test/java/hudson/PluginManagerTest.java b/core/src/test/java/hudson/PluginManagerTest.java index 5e1db07d73..64d83892fd 100644 --- a/core/src/test/java/hudson/PluginManagerTest.java +++ b/core/src/test/java/hudson/PluginManagerTest.java @@ -114,7 +114,7 @@ public class PluginManagerTest { equalTo(jar.lastModified())); } - private static void assertAttribute(Manifest manifest, String attributeName, String value) throws AssertionError { + private static void assertAttribute(Manifest manifest, String attributeName, String value) { Attributes attributes = manifest.getMainAttributes(); assertThat("Main attributes must not be empty", attributes, notNullValue()); assertThat("Attribute '" + attributeName + "' does not match the sample", diff --git a/test/src/test/java/hudson/model/ItemGroupMixInTest.java b/test/src/test/java/hudson/model/ItemGroupMixInTest.java index 08ca57fbb1..7a91c0516f 100644 --- a/test/src/test/java/hudson/model/ItemGroupMixInTest.java +++ b/test/src/test/java/hudson/model/ItemGroupMixInTest.java @@ -218,7 +218,7 @@ public class ItemGroupMixInTest { @Issue("JENKINS-61956") @Test - public void copy_checkGoodName() throws Failure, IOException { + public void copy_checkGoodName() throws IOException { final String goodName = "calvin-jenkins"; final String badName = "calvin@jenkins"; @@ -230,7 +230,7 @@ public class ItemGroupMixInTest { @Issue("JENKINS-61956") @Test - public void createProject_checkGoodName() throws Failure { + public void createProject_checkGoodName() { final String badName = "calvin@jenkins"; Failure exception = assertThrows(Failure.class, () -> { r.jenkins.createProject(MockFolder.class, badName); }); @@ -239,7 +239,7 @@ public class ItemGroupMixInTest { @Issue("JENKINS-61956") @Test - public void createProjectFromXML_checkGoodName() throws Failure { + public void createProjectFromXML_checkGoodName() { final String badName = "calvin@jenkins"; final String xml = "\n" + diff --git a/test/src/test/java/hudson/model/MyViewsPropertyTest.java b/test/src/test/java/hudson/model/MyViewsPropertyTest.java index 7b717baf34..935ed5ab36 100644 --- a/test/src/test/java/hudson/model/MyViewsPropertyTest.java +++ b/test/src/test/java/hudson/model/MyViewsPropertyTest.java @@ -174,7 +174,7 @@ public class MyViewsPropertyTest { } @Test - public void testOnViewRenamed() throws IOException, Failure, FormException { + public void testOnViewRenamed() throws IOException, FormException { User user = User.getOrCreateByIdOrFullName("User"); MyViewsProperty property = new MyViewsProperty(AllView.DEFAULT_VIEW_NAME); property.readResolve(); diff --git a/test/src/test/java/jenkins/AgentProtocolTest.java b/test/src/test/java/jenkins/AgentProtocolTest.java index ccfdbb9ad2..3f0bac4e22 100644 --- a/test/src/test/java/jenkins/AgentProtocolTest.java +++ b/test/src/test/java/jenkins/AgentProtocolTest.java @@ -55,11 +55,11 @@ public class AgentProtocolTest { assertProtocols(true, "System protocols should be always enabled", "Ping"); } - private void assertEnabled(String ... protocolNames) throws AssertionError { + private void assertEnabled(String ... protocolNames) { assertProtocols(true, null, protocolNames); } - private void assertDisabled(String ... protocolNames) throws AssertionError { + private void assertDisabled(String ... protocolNames) { assertProtocols(false, null, protocolNames); } @@ -67,8 +67,7 @@ public class AgentProtocolTest { assertProtocols(j.jenkins, shouldBeEnabled, why, protocolNames); } - public static void assertProtocols(Jenkins jenkins, boolean shouldBeEnabled, @CheckForNull String why, String ... protocolNames) - throws AssertionError { + public static void assertProtocols(Jenkins jenkins, boolean shouldBeEnabled, @CheckForNull String why, String ... protocolNames) { Set agentProtocols = jenkins.getAgentProtocols(); List failedChecks = new ArrayList<>(); for (String protocol : protocolNames) { diff --git a/test/src/test/java/jenkins/install/InstallStateTest.java b/test/src/test/java/jenkins/install/InstallStateTest.java index 3a841dac5c..17e76721ce 100644 --- a/test/src/test/java/jenkins/install/InstallStateTest.java +++ b/test/src/test/java/jenkins/install/InstallStateTest.java @@ -86,7 +86,7 @@ public class InstallStateTest { assertThat(state, equalTo(InstallState.UNKNOWN)); } - private static InstallState forName(String name) throws AssertionError { + private static InstallState forName(String name) { String xml = "\n" + " true\n" + " " + name + "\n" + @@ -94,7 +94,7 @@ public class InstallStateTest { return forXml(xml); } - private static InstallState forXml(String xml) throws AssertionError { + private static InstallState forXml(String xml) { Object read = Jenkins.XSTREAM2.fromXML(xml); assertThat(read, instanceOf(InstallState.class)); InstallState state = (InstallState) read; diff --git a/test/src/test/java/jenkins/model/JenkinsTest.java b/test/src/test/java/jenkins/model/JenkinsTest.java index 13de45a169..176bdf52b2 100644 --- a/test/src/test/java/jenkins/model/JenkinsTest.java +++ b/test/src/test/java/jenkins/model/JenkinsTest.java @@ -620,12 +620,12 @@ public class JenkinsTest { assertProtocolDisabled(protocolToDisable2, "after the roundtrip"); } - private void assertProtocolDisabled(String protocolName, @CheckForNull String stage) throws AssertionError { + private void assertProtocolDisabled(String protocolName, @CheckForNull String stage) { assertThat(protocolName + " must be disabled. Stage=" + (stage != null ? stage : "undefined"), j.jenkins.getAgentProtocols(), not(hasItem(protocolName))); } - private void assertProtocolEnabled(String protocolName, @CheckForNull String stage) throws AssertionError { + private void assertProtocolEnabled(String protocolName, @CheckForNull String stage) { assertThat(protocolName + " must be enabled. Stage=" + (stage != null ? stage : "undefined"), j.jenkins.getAgentProtocols(), hasItem(protocolName)); } diff --git a/test/src/test/java/jenkins/slaves/OldRemotingAgentTest.java b/test/src/test/java/jenkins/slaves/OldRemotingAgentTest.java index ac16de3557..51a21b34f9 100644 --- a/test/src/test/java/jenkins/slaves/OldRemotingAgentTest.java +++ b/test/src/test/java/jenkins/slaves/OldRemotingAgentTest.java @@ -171,13 +171,13 @@ public class OldRemotingAgentTest { private static class NodeMonitorAssert extends NodeMonitor { - static void assertMonitors(Collection toCheck, Computer c) throws AssertionError { + static void assertMonitors(Collection toCheck, Computer c) { for (NodeMonitor monitor : toCheck) { assertMonitor(monitor, c); } } - static void assertMonitor(NodeMonitor monitor, Computer c) throws AssertionError { + static void assertMonitor(NodeMonitor monitor, Computer c) { AbstractNodeMonitorDescriptor descriptor = monitor.getDescriptor(); final Method monitorMethod; try { diff --git a/test/src/test/java/jenkins/slaves/RemotingVersionInfoTest.java b/test/src/test/java/jenkins/slaves/RemotingVersionInfoTest.java index 991e57a72e..24123c9ed4 100644 --- a/test/src/test/java/jenkins/slaves/RemotingVersionInfoTest.java +++ b/test/src/test/java/jenkins/slaves/RemotingVersionInfoTest.java @@ -59,7 +59,7 @@ public class RemotingVersionInfoTest { } } - private void assertAttributeValue(Manifest manifest, String attributeName, Object expectedValue) throws AssertionError { + private void assertAttributeValue(Manifest manifest, String attributeName, Object expectedValue) { assertThat("Wrong value of manifest attribute " + attributeName, manifest.getMainAttributes().getValue(attributeName), equalTo(expectedValue.toString())); diff --git a/test/src/test/java/org/kohsuke/stapler/MockStaplerRequestBuilder.java b/test/src/test/java/org/kohsuke/stapler/MockStaplerRequestBuilder.java index 485621f5e2..a20a2e62e1 100644 --- a/test/src/test/java/org/kohsuke/stapler/MockStaplerRequestBuilder.java +++ b/test/src/test/java/org/kohsuke/stapler/MockStaplerRequestBuilder.java @@ -65,7 +65,7 @@ public class MockStaplerRequestBuilder{ return this; } - public StaplerRequest build() throws AssertionError { + public StaplerRequest build() { HttpServletRequest rawRequest = Mockito.mock(HttpServletRequest.class); return new RequestImpl(stapler != null ? stapler : new Stapler(), rawRequest, ancestors, tokens); }