Java Code Examples for io.restassured.module.mockmvc.RestAssuredMockMvc#standaloneSetup()

The following examples show how to use io.restassured.module.mockmvc.RestAssuredMockMvc#standaloneSetup() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApiCatalogControllerTests.java    From api-layer with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void whenGetAllContainers_givenNothing_thenReturnContainersWithState() {
    Application service1 = new Application("service-1");
    service1.addInstance(getStandardInstance("service1", InstanceInfo.InstanceStatus.UP));

    Application service2 = new Application("service-2");
    service1.addInstance(getStandardInstance("service2", InstanceInfo.InstanceStatus.DOWN));

    given(this.cachedServicesService.getService("service1")).willReturn(service1);
    given(this.cachedServicesService.getService("service2")).willReturn(service2);
    given(this.cachedProductFamilyService.getAllContainers()).willReturn(createContainers());

    RestAssuredMockMvc.standaloneSetup(apiCatalogController);
    RestAssuredMockMvc.given().
        when().
        get("/containers").
        then().
        statusCode(200);
}
 
Example 2
Source File: CommandContractTest.java    From ESarch with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    final CommandGateway commandGateway = mock(CommandGateway.class);

    when(commandGateway.send(any())).thenReturn(completedFuture(null));
    when(commandGateway.send(any(CreateCompanyCommand.class)))
            .thenReturn(completedFuture(COMPANY_ID));
    when(commandGateway.send(any(CreateOrderBookCommand.class)))
            .thenReturn(completedFuture(ORDER_BOOK_ID));
    when(commandGateway.send(any(CreatePortfolioCommand.class)))
            .thenReturn(completedFuture(PORTFOLIO_ID));
    when(commandGateway.send(any(CreateUserCommand.class)))
            .thenReturn(completedFuture(USER_ID));
    when(commandGateway.send(any(StartBuyTransactionCommand.class)))
            .thenReturn(completedFuture(BUY_TRANSACTION_ID));
    when(commandGateway.send(any(StartSellTransactionCommand.class)))
            .thenReturn(completedFuture(SELL_TRANSACTION_ID));

    final ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.registerModule(new KotlinModule());
    final JsonSchemaGenerator jsonSchemaGenerator = new JsonSchemaGenerator(objectMapper);

    final CommandController commandController =
            new CommandController(commandGateway, objectMapper, jsonSchemaGenerator);
    commandController.setBeanClassLoader(this.getClass().getClassLoader());

    RestAssuredMockMvc.standaloneSetup(commandController);
}
 
Example 3
Source File: MvcTest.java    From friendly-id with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
	mockMvcBuilder = standaloneSetup(new FooController(mock(EntityLinks.class)));
	DefaultFormattingConversionService service = new DefaultFormattingConversionService();
	service.addConverter(new StringToUuidConverter());
	mockMvcBuilder.setMessageConverters(jackson2HttpMessageConverter()).setConversionService(service);
	RestAssuredMockMvc.standaloneSetup(mockMvcBuilder);
}
 
Example 4
Source File: BeerRestBase.java    From spring-cloud-contract-samples with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() {
	RestAssuredMockMvc.standaloneSetup(this.producerController, this.statsController);
}
 
Example 5
Source File: YmlFraudBase.java    From spring-cloud-contract with Apache License 2.0 4 votes vote down vote up
@BeforeEach
public void setup() {
	RestAssuredMockMvc.standaloneSetup(new FraudDetectionController(),
			new FraudStatsController(stubbedStatsProvider()));
}
 
Example 6
Source File: BaseAccurest.java    From spring-cloud-contract with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() {
	RestAssuredMockMvc.standaloneSetup(new GreetingController());
}
 
Example 7
Source File: BaseAccurest.java    From spring-cloud-contract with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() {
	RestAssuredMockMvc.standaloneSetup(new FraudDetectionController());
}
 
Example 8
Source File: TestBase.java    From spring-cloud-contract with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() {
	RestAssuredMockMvc.standaloneSetup(new FraudDetectionController());
}
 
Example 9
Source File: BeerRestBase.java    From spring-cloud-contract-samples with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() {
	RestAssuredMockMvc
			.standaloneSetup(MockMvcBuilders.webAppContextSetup(this.context)
					.addFilter(this.springSecurityFilterChain));
}
 
Example 10
Source File: MvcTest.java    From spring-cloud-contract with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() {
	RestAssuredMockMvc.standaloneSetup(
			new org.springframework.cloud.frauddetection.FraudDetectionController());
}
 
Example 11
Source File: CourseControllerUnitTest.java    From tutorials with MIT License 4 votes vote down vote up
@Before
public void initialiseRestAssuredMockMvcStandalone() {
    RestAssuredMockMvc.standaloneSetup(courseController, courseControllerExceptionHandler);
}
 
Example 12
Source File: BeerRestBase.java    From spring-cloud-contract-samples with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() {
	RestAssuredMockMvc.standaloneSetup(this.producerController);
}
 
Example 13
Source File: MultipartBase.java    From spring-cloud-contract with Apache License 2.0 4 votes vote down vote up
@BeforeEach
public void setUp() throws Exception {
	RestAssuredMockMvc.standaloneSetup(new TestController());
}
 
Example 14
Source File: MvcMockTest.java    From JetfireCloud with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() {
    RestAssuredMockMvc.standaloneSetup(new HelloController());
}
 
Example 15
Source File: BeerRestBase.java    From spring-cloud-contract-samples with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() {
	RestAssuredMockMvc.standaloneSetup(this.producerController);
}
 
Example 16
Source File: YmlFraudnameBase.java    From spring-cloud-contract with Apache License 2.0 4 votes vote down vote up
@BeforeEach
public void setup() {
	RestAssuredMockMvc.standaloneSetup(new FraudNameController(this.fraudVerifier));
}
 
Example 17
Source File: FraudBase.java    From spring-cloud-contract with Apache License 2.0 4 votes vote down vote up
@BeforeEach
public void setup() {
	RestAssuredMockMvc.standaloneSetup(new FraudDetectionController(),
			new FraudStatsController(stubbedStatsProvider()));
}
 
Example 18
Source File: TestBase.java    From spring-cloud-contract with Apache License 2.0 4 votes vote down vote up
@BeforeEach
public void setUp() throws Exception {
	RestAssuredMockMvc.standaloneSetup(new TestController());
}
 
Example 19
Source File: ApiBase.java    From event-store-demo with GNU General Public License v3.0 3 votes vote down vote up
@Before
public void setup() {

    when( this.service.createBoard() ).thenReturn( this.boardUuid );
    when( this.service.addStory( any( UUID.class ), anyString() ) ).thenReturn( this.storyUuid );

    RestAssuredMockMvc.standaloneSetup( this.controller );

    verifyNoMoreInteractions( this.service );

}
 
Example 20
Source File: ApiBase.java    From event-store-demo with GNU General Public License v3.0 3 votes vote down vote up
@Before
public void setup() {

    when( this.service.find( any( UUID.class ) ) ).thenReturn( new Board( boardUuid ) );

    RestAssuredMockMvc.standaloneSetup( this.controller );

    verifyNoMoreInteractions( this.service );

}