Skip to content

Instantly share code, notes, and snippets.

@yusufcakal
Created June 6, 2019 18:23
Show Gist options
  • Save yusufcakal/7b528542346411933bfb0cb9140b2978 to your computer and use it in GitHub Desktop.
Save yusufcakal/7b528542346411933bfb0cb9140b2978 to your computer and use it in GitHub Desktop.
Util class for controller integration test in spring boot
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
@ActiveProfiles("test")
public abstract class BaseControllerIntegrationTest {
@PersistenceContext
protected EntityManager entityManager;
@Autowired
protected MockMvc mockMvc;
@Autowired
protected Gson gson;
protected String toJson(Object object) {
return gson.toJson(object);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment