Class GitHubMockDefaultAnswer

java.lang.Object
io.quarkiverse.githubapp.testing.mockito.internal.GitHubMockDefaultAnswer
All Implemented Interfaces:
Serializable, org.mockito.stubbing.Answer<Object>

public final class GitHubMockDefaultAnswer extends Object implements org.mockito.stubbing.Answer<Object>, Serializable
The default answer for all GitHub mocks.

The purpose of this default answer is to control the behavior of a few special methods:

  • package-protected methods such as GitHub#intern(GHUser), whose stubbing would normally require relying on external help such as Powermock.
  • other methods that need to be stubbed but cannot, because they are not guaranteed to be called and thus might trigger an UnnecessaryStubbingException in Mock.Strictness.STRICT_STUBS mode. (example: GitHub.isOffline())
See Also:
  • Constructor Details

    • GitHubMockDefaultAnswer

      public GitHubMockDefaultAnswer(org.mockito.stubbing.Answer<Object> delegate, Function<String,org.kohsuke.github.GHRepository> repositoryMockProvider)
  • Method Details

    • answer

      public Object answer(org.mockito.invocation.InvocationOnMock invocation) throws Throwable
      Specified by:
      answer in interface org.mockito.stubbing.Answer<Object>
      Throws:
      Throwable