Test automation
The DGS framework provides classes and utilities that facilitate the automation of GraphQL API tests.
Create a new file called ProductDatafetcherTest.java
inside the datafetchers
package in the test
directory and add the following code:
@SpringBootTest(classes = { DgsAutoConfiguration.class, ProductDatafetcher.class,BigDecimalScalar.class }) public class ProductDatafetcherTest { private final InMemRepository repo = new InMemRepository(); private final int TEN = 10; @Autowired private DgsQueryExecutor dgsQueryExecutor; @MockBean private ProductService productService; @MockBean private TagService tagService; // continue …
Here, you are using the @SpringBootTest...