Class AlwaysThrows

java.lang.Object
org.soliscode.test.util.AlwaysThrows
All Implemented Interfaces:
Comparable<AlwaysThrows>

public class AlwaysThrows extends Object implements Comparable<AlwaysThrows>
Class that implements the Object and Comparable interfaces, and that throws an exception when any method is called.
Author:
evanbergstrom
  • Constructor Details

    • AlwaysThrows

      public AlwaysThrows()
      Creates an instance that always throws an UnsupportedOperationException for every method call.
    • AlwaysThrows

      public AlwaysThrows(Supplier<RuntimeException> exceptionSupplier)
      Creates an instance that always throws an exception that is provided by the supplier parameter.
      Parameters:
      exceptionSupplier - The supplied used to generate exceptions.
  • Method Details

    • equals

      public boolean equals(Object obj)
      Always throws the supplied exception
      Overrides:
      equals in class Object
      Parameters:
      obj - The object to compare for equality (not used).
      Returns:
      Never returns a value
    • hashCode

      public int hashCode()
      Always throws the supplied exception
      Overrides:
      hashCode in class Object
      Returns:
      Never returns a value
    • compareTo

      public int compareTo(@NotNull @NotNull AlwaysThrows obj)
      Always throws the supplied exception
      Specified by:
      compareTo in interface Comparable<AlwaysThrows>
      Parameters:
      obj - The object to compare (not used).
      Returns:
      Never returns a value
    • toString

      public String toString()
      Always throws the supplied exception
      Overrides:
      toString in class Object
      Returns:
      Never returns a value