Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- spring:
- datasource:
- url: jdbc:h2:mem:test;
- driverClassName: org.h2.Driver
- username: sa
- password:
- jpa:
- database: h2
- database-platform: org.hibernate.dialect.H2Dialect
- hibernate:
- ddl-auto: create
- naming.physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
- properties:
- hibernate:
- show_sql: true
- format_sql: false
- CREATE SCHEMA AB AUTHORIZATION SA;
- @RunWith(SpringRunner.class)
- @ContextConfiguration(initializers = ConfigFileApplicationContextInitializer.class)
- @SpringBootTest(classes = WebApp.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
- @AutoConfigureMockMvc
- @ActiveProfiles("test")
- public class AbcControllerTest {
- @Autowired
- private MockMvc mockMvc;
- @Autowired
- private LeDataService leDataService;
- @Before
- public void setup() {
- MyInfo myInfo = new MyInfo();
- ..............
- ..............
- leDataService.save(myInfo);
- }
- @Test
- public void getAbcTest() throws Exception {
- mockMvc.perform(MockMvcRequestBuilders.get("/api/v1/Abcs/1234567/12345678")
- .with(SecurityMockMvcRequestPostProcessors.user("test").password("test123"))
- .with(SecurityMockMvcRequestPostProcessors.csrf()))
- .andExpect(status().isOk())
- }
- }
Add Comment
Please, Sign In to add comment