#BAEL-2862: update test case
This commit is contained in:
parent
9b206922fd
commit
32763ab63d
|
@ -1,23 +1,19 @@
|
|||
package com.baeldung.web.controller;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
import com.baeldung.web.log.app.Application;
|
||||
import com.baeldung.web.log.data.TaxiRide;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.web.server.LocalServerPort;
|
||||
import org.springframework.boot.test.web.server.LocalServerPort;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
|
||||
import com.baeldung.web.log.app.Application;
|
||||
import com.baeldung.web.log.data.TaxiRide;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = { Application.class, TaxiFareControllerIntegrationTest.SecurityConfig.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@SpringBootTest(classes = { Application.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class TaxiFareControllerIntegrationTest {
|
||||
|
||||
@LocalServerPort
|
||||
|
@ -25,8 +21,6 @@ public class TaxiFareControllerIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void givenRequest_whenFetchTaxiFareRateCard_thanOK() {
|
||||
|
||||
System.out.println(port);
|
||||
String URL = "http://localhost:" + port + "/spring-rest";
|
||||
TestRestTemplate testRestTemplate = new TestRestTemplate();
|
||||
TaxiRide taxiRide = new TaxiRide(true, 10l);
|
||||
|
@ -37,16 +31,4 @@ public class TaxiFareControllerIntegrationTest {
|
|||
assertThat(fare, equalTo("200"));
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
System.out.println("security being set");
|
||||
http
|
||||
.authorizeRequests()
|
||||
.anyRequest().permitAll()
|
||||
.and()
|
||||
.csrf().disable();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue