Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. enter code here
  2.  
  3. Application
  4. -app-web-module
  5. -src/java/com/org/SpringApplicationClass
  6. -pom.xml
  7. -app-web-unitcases
  8. -src/test/com/org/mytestclass
  9. -pom.xml
  10.  
  11. @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
  12. @AutoConfigureWebTestClient
  13. @TestInstance(TestInstance.Lifecycle.PER_CLASS)
  14. @ContextConfiguration(classes = com.org.MainApplication.class)
  15. public class BaseACTest {
  16.  
  17.  
  18. @Autowired
  19. private WebTestClient webTestClient;
  20.  
  21. @BeforeAll
  22. public void init1() {
  23. MockitoAnnotations.initMocks(this);
  24. }
  25.  
  26. @BeforeEach
  27. public void init() {
  28. Assertions.assertNotNull(webTestClient);
  29. }
  30.  
  31. @Test
  32. public void testGetAllAmenities() {
  33. webTestClient.get().uri("/urltobeplaced/1234")
  34. .header("X-Request-ID", "123")
  35. .header("X-Session-ID", "123")
  36. .header("X-Application-ID", "123")
  37. .exchange()
  38. .expectStatus().isOk();
  39. }
  40.  
  41. }```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement