Class JenkinsMatchers


  • public class JenkinsMatchers
    extends Object
    Some handy matchers.
    Since:
    1.436
    Author:
    Stephen Connolly
    • Constructor Detail

      • JenkinsMatchers

        public JenkinsMatchers()
    • Method Detail

      • privateConstructorThrows

        public static org.hamcrest.Matcher<Class<?>> privateConstructorThrows​(Class<? extends Throwable> cause)
      • causedBy

        public static org.hamcrest.Matcher<hudson.util.FormValidation> causedBy​(Class<? extends Throwable> cause)
      • hasKind

        public static org.hamcrest.Matcher<hudson.util.FormValidation> hasKind​(hudson.util.FormValidation.Kind kind)
      • isUtilityClass

        public static org.hamcrest.Matcher<Class<?>> isUtilityClass()
        A matcher which checks that the class is a Utility class (i.e. is final and has only private constructors).
        Returns:
        A matcher which checks that the class is a Utility class (i.e. is final and has only private constructors).
      • isClassWithOnlyPrivateConstructors

        public static org.hamcrest.Matcher<Class<?>> isClassWithOnlyPrivateConstructors()
        A matcher which checks that the class has only private constructors.
        Returns:
        A matcher which checks that the class has only private constructors.
      • isFinalClass

        public static org.hamcrest.Matcher<Class<?>> isFinalClass()
        A matcher which checks that the class is final.
        Returns:
        A matcher which checks that the class is final.
      • hasDefaultConstructor

        public static org.hamcrest.Matcher<Class<?>> hasDefaultConstructor()
        A matcher which checks that the class has the default constructor.
        Returns:
        A matcher which checks that the class has the default constructor.
      • hasCause

        public static org.hamcrest.Matcher<Throwable> hasCause​(Class<? extends Throwable> cause)
        A matcher that verifies that the a root cause of an exception is of the specified type.
        Parameters:
        cause - the type of exception that caused this.
        Returns:
        A matcher that verifies that the a root cause of an exception is of the specified type.
      • hasImplementedEquals

        public static org.hamcrest.Matcher<Object> hasImplementedEquals()
      • hasReflexiveEquals

        public static org.hamcrest.Matcher<Object> hasReflexiveEquals()
      • hasNonEqualityWithNulls

        public static org.hamcrest.Matcher<Object> hasNonEqualityWithNulls()
      • hasSymmetricEquals

        public static org.hamcrest.Matcher<Object> hasSymmetricEquals​(Object other)
      • hasConsistentEquals

        public static org.hamcrest.Matcher<Object> hasConsistentEquals​(Object other)
      • hasTransitiveEquals

        public static org.hamcrest.Matcher<Object> hasTransitiveEquals​(Object a,
                                                                       Object b)
      • hasImplementedHashCode

        public static org.hamcrest.Matcher<Object> hasImplementedHashCode()
      • hasHashCodeContract

        public static org.hamcrest.Matcher<Object> hasHashCodeContract​(Object other)
      • hasPlainText

        public static org.hamcrest.Matcher<hudson.util.Secret> hasPlainText​(org.hamcrest.Matcher<? super String> matcher)
        Returns a Matcher for the plain text value of a Secret.
        Since:
        2.50
      • hasPlainText

        public static org.hamcrest.Matcher<hudson.util.Secret> hasPlainText​(String expected)
        Returns a Matcher for the plain text value of a Secret.
        Since:
        2.50
      • matchesPattern

        public static org.hamcrest.Matcher<String> matchesPattern​(String pattern)
        Returns a Matcher that matches against the given pattern using Matcher.find().
        Since:
        2.50