mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-14 20:42:21 +00:00
Code clean up.
This commit is contained in:
1 parent
7143bf7c24
commit
aa1f5ccbf3
19 files changed
+20
-27
No files matched your search
@@ -599,9 +599,7 @@ public class UtilTest {
|
||||
|
||||
@Test
|
||||
public void ifOverriddenFailure() {
|
||||
AbstractMethodError error = Assert.assertThrows(AbstractMethodError.class, () -> {
|
||||
Util.ifOverridden(() -> true, BaseClass.class, DerivedClassFailure.class, "method");
|
||||
});
|
||||
AbstractMethodError error = Assert.assertThrows(AbstractMethodError.class, () -> Util.ifOverridden(() -> true, BaseClass.class, DerivedClassFailure.class, "method"));
|
||||
assertEquals("The class " + DerivedClassFailure.class.getName() + " must override at least one of the BaseClass.method methods", error.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class XmlFileTest {
|
||||
|
||||
XmlFile xmlFile = new XmlFile(xs, new File(configUrl.getFile()));
|
||||
if (xmlFile.exists()) {
|
||||
assertThrows(SAXParseException.class, () -> xmlFile.read());
|
||||
assertThrows(SAXParseException.class, xmlFile::read);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package jenkins;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import hudson.remoting.Channel;
|
||||
import hudson.remoting.Which;
|
||||
|
||||
@@ -13,14 +13,14 @@ public class JenkinsJVMTest {
|
||||
|
||||
@Test
|
||||
public void checkJenkinsJVM_WhenNotInAJenkinsJVM() {
|
||||
assertThrows(IllegalStateException.class, () -> JenkinsJVM.checkJenkinsJVM());
|
||||
assertThrows(IllegalStateException.class, JenkinsJVM::checkJenkinsJVM);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkNotJenkinsJVM_WhenInAJenkinsJVM() {
|
||||
JenkinsJVM.setJenkinsJVM(true);
|
||||
try {
|
||||
assertThrows(IllegalStateException.class, () -> JenkinsJVM.checkNotJenkinsJVM());
|
||||
assertThrows(IllegalStateException.class, JenkinsJVM::checkNotJenkinsJVM);
|
||||
} finally {
|
||||
JenkinsJVM.setJenkinsJVM(false);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class VirtualFileTest {
|
||||
VirtualFile hack = root.child("hack");
|
||||
assertFalse(hack.isFile());
|
||||
assertFalse(hack.exists());
|
||||
assertThrows(FileNotFoundException.class, () -> hack.open());
|
||||
assertThrows(FileNotFoundException.class, hack::open);
|
||||
}
|
||||
|
||||
@Issue("JENKINS-26810")
|
||||
|
||||
Reference in new issue
Block a user