Search code examples
graphqlgraphql-java

mock api response in graphql-java


I have a graphql API written using graphql-java-tools and graphql-java. I want to mock a query operation. How can I do this? Is Apollo graphql-tools the only way to achieve this. I havent used any other apolo library in my project yet and didnt want to go that route for just mocking service.


Solution

  • There is no library that supports mocking in java as of now( Apollo-graphql-tools supports only nodejs). I think best way is to mock it yourself creating new objects.