Guest User

Untitled

a guest
Nov 3rd, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. spring:
  2. datasource:
  3. url: jdbc:h2:mem:test;
  4. driverClassName: org.h2.Driver
  5. username: sa
  6. password:
  7. jpa:
  8. database: h2
  9. database-platform: org.hibernate.dialect.H2Dialect
  10. hibernate:
  11. ddl-auto: create
  12. naming.physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
  13. properties:
  14. hibernate:
  15. show_sql: true
  16. format_sql: false
  17.  
  18. CREATE SCHEMA AB AUTHORIZATION SA;
  19.  
  20. @RunWith(SpringRunner.class)
  21. @ContextConfiguration(initializers = ConfigFileApplicationContextInitializer.class)
  22. @SpringBootTest(classes = WebApp.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
  23. @AutoConfigureMockMvc
  24. @ActiveProfiles("test")
  25. public class AbcControllerTest {
  26.  
  27. @Autowired
  28. private MockMvc mockMvc;
  29.  
  30. @Autowired
  31. private LeDataService leDataService;
  32.  
  33. @Before
  34. public void setup() {
  35. MyInfo myInfo = new MyInfo();
  36. ..............
  37. ..............
  38. leDataService.save(myInfo);
  39. }
  40.  
  41. @Test
  42. public void getAbcTest() throws Exception {
  43. mockMvc.perform(MockMvcRequestBuilders.get("/api/v1/Abcs/1234567/12345678")
  44. .with(SecurityMockMvcRequestPostProcessors.user("test").password("test123"))
  45. .with(SecurityMockMvcRequestPostProcessors.csrf()))
  46. .andExpect(status().isOk())
  47. }
  48.  
  49. }
Add Comment
Please, Sign In to add comment