From 32763ab63d9169ecfae4ba7540aa94d435f8ef40 Mon Sep 17 00:00:00 2001 From: h_sharifi Date: Mon, 2 Jan 2023 14:12:00 +0330 Subject: [PATCH] #BAEL-2862: update test case --- .../TaxiFareControllerIntegrationTest.java | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/spring-boot-modules/spring-boot-runtime/src/test/java/com/baeldung/web/controller/TaxiFareControllerIntegrationTest.java b/spring-boot-modules/spring-boot-runtime/src/test/java/com/baeldung/web/controller/TaxiFareControllerIntegrationTest.java index 97d669d3fa..b98c77ad2b 100644 --- a/spring-boot-modules/spring-boot-runtime/src/test/java/com/baeldung/web/controller/TaxiFareControllerIntegrationTest.java +++ b/spring-boot-modules/spring-boot-runtime/src/test/java/com/baeldung/web/controller/TaxiFareControllerIntegrationTest.java @@ -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(); - } - } } \ No newline at end of file