# Class UnexpectedBuildSuccess

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.gradle.testkit.runner.UnexpectedBuildResultException
org.gradle.testkit.runner.UnexpectedBuildSuccess

All Implemented Interfaces:
  `Serializable`

public class UnexpectedBuildSuccess extends UnexpectedBuildResultException
Thrown when executing a build that was expected to fail, but succeeded.

Since:
  2.6
See Also:
  - `GradleRunner.buildAndFail()`
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UnexpectedBuildSuccess(String message, BuildResult buildResult)`
  Creates a new `UnexpectedBuildSuccess`.

- ## Method Summary

  ### Methods inherited from class UnexpectedBuildResultException

  `getBuildResult`

  ### Methods inherited from class Throwable

  `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### UnexpectedBuildSuccess

    public UnexpectedBuildSuccess(String message, BuildResult buildResult)
    Creates a new `UnexpectedBuildSuccess`.
    Since:
      2.9