Skip to content

skjolber/mockito-graphql-matchers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mockito-graphql-matchers

Mockito argument-matchers for GraphQL.

Features:

  • query
    • name
    • arguments
  • mutation
    • name
    • arguments

The library is primarily intended for mocking proxied GraphQL service implementations, i.e. without needing the whole payload.

Obtain

The project is built with Maven and is available on the central Maven repository.

Maven coordinates

Add the property

<mockito-graphql-matchers.version>1.0.0</mockito-graphql-matchers.version>

then add

<dependency>
    <groupId>com.github.skjolber.mockito.graphql</groupId>
    <artifactId>matchers</artifactId>
    <version>${mockito-graphql-matchers.version}</version>
</dependency>

or

Gradle coordinates

For

ext {
  mockitoGraphqlMatchersVersion = '1.0.0'
}

add

api ("com.github.skjolber.mockito.graphql:matchers:${mockitoGraphqlMatchersVersion}")

Usage

Add import

import static com.github.skjolber.mockito.graphql.matchers.ArgumentMatchers.*;

then start mocking

when(http.exchange(queryName("getUser"))).thenReturn("{ ... user response ... }");
when(http.exchange(queryName("getTickets"))).thenReturn("{ ... tickets response ... }");

so to emulate more complex mock GraphQL service behaviors.

License

Apache 2.0

History

  • 1.0.0: Initial release.

About

GraphQL matchers for Mockito

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages