This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mockMvc.perform(get("/api/offers")) | |
.andExpect(status().isOk()) | |
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mockMvc.perform(get("/api/offers")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; | |
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | |
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; | |
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.espen.tests; | |
import org.junit.Before; | |
import org.junit.runner.RunWith; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.test.context.SpringBootTest; | |
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |
import org.springframework.test.context.TestPropertySource; | |
import org.springframework.test.context.junit4.SpringRunner; | |
import org.springframework.test.web.servlet.MockMvc; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Data-Source-Settings | |
spring.datasource.url=jdbc:h2:mem:mydb;DB_CLOSE_ON_EXIT=FALSE | |
spring.datasource.username=root | |
spring.datasource.password=dbpass | |
spring.datasource.driver-class-name=org.h2.Driver | |
spring.datasource.platform: h2 | |
# The SQL dialect makes Hibernate generate better SQL for the chosen database |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; | |
import static org.springframework.restdocs.request.RequestDocumentation.pathParameters; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete; | |
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; | |
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.put; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.restdocs.mockmvc.RestDocumentationResultHandler; | |
import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; | |
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest; | |
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.restdocs.payload.FieldDescriptor; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; | |
import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields; | |
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; |