diff --git a/core/src/test/java/hudson/util/ConsistentHashTest.java b/core/src/test/java/hudson/util/ConsistentHashTest.java index 0b7d77f6de..474c206ae5 100644 --- a/core/src/test/java/hudson/util/ConsistentHashTest.java +++ b/core/src/test/java/hudson/util/ConsistentHashTest.java @@ -96,7 +96,7 @@ public class ConsistentHashTest { } } - System.out.printf("%d/%d\n", even, odd); + System.out.printf("%d/%d%n", even, odd); assertTrue(even * 8 < odd); } diff --git a/core/src/test/java/hudson/util/SecretTest.java b/core/src/test/java/hudson/util/SecretTest.java index efe2c043ae..2092b8a9a4 100644 --- a/core/src/test/java/hudson/util/SecretTest.java +++ b/core/src/test/java/hudson/util/SecretTest.java @@ -67,8 +67,9 @@ public class SecretTest { @Test public void encryptedValuePattern() { + final Random random = new Random(); for (int i = 1; i < 100; i++) { - String plaintext = RandomStringUtils.random(new Random().nextInt(i)); + String plaintext = RandomStringUtils.random(random.nextInt(i)); String ciphertext = Secret.fromString(plaintext).getEncryptedValue(); //println "${plaintext} → ${ciphertext}" assert ENCRYPTED_VALUE_PATTERN.matcher(ciphertext).matches(); diff --git a/core/src/test/java/jenkins/util/xstream/XStreamDOMTest.java b/core/src/test/java/jenkins/util/xstream/XStreamDOMTest.java index 1774b803e0..752dc82394 100644 --- a/core/src/test/java/jenkins/util/xstream/XStreamDOMTest.java +++ b/core/src/test/java/jenkins/util/xstream/XStreamDOMTest.java @@ -30,6 +30,7 @@ import org.junit.Test; import org.xmlunit.diff.DefaultNodeMatcher; import org.xmlunit.diff.ElementSelectors; +import static org.hamcrest.Matchers.instanceOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.hamcrest.MatcherAssert.assertThat; @@ -141,7 +142,7 @@ public class XStreamDOMTest { v.values.put("foo",createSomeFoo().bar); String xml = xs.toXML(v); Object v2 = xs.fromXML(xml); - assertTrue(v2 instanceof DomInMap); + assertThat(v2, instanceOf(DomInMap.class)); assertXStreamDOMEquals(v.values.get("foo"), ((DomInMap)v2).values.get("foo")); }