Test automation
The DGS framework provides you with classes and utilities that you can use to test GraphQL APIs.
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…
https...