Skip to content

Commit 46cc39e

Browse files
committed
add swagger test
1 parent 27c1ed3 commit 46cc39e

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎spring-security-rest/src/main/java/org/baeldung/spring/SecurityJavaConfig.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected void configure(final HttpSecurity http) throws Exception {// @formatte
4444
.authorizeRequests()
4545
.antMatchers("/api/csrfAttacker*").permitAll()
4646
.antMatchers("/api/customer/**").permitAll()
47-
.antMatchers("/api/**").authenticated()
47+
.antMatchers("/api/foos/**").authenticated()
4848
.and()
4949
.formLogin()
5050
.successHandler(authenticationSuccessHandler)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.baeldung.web;
2+
3+
import static org.junit.Assert.assertEquals;
4+
5+
import org.junit.Test;
6+
7+
import com.jayway.restassured.RestAssured;
8+
import com.jayway.restassured.response.Response;
9+
10+
public class SwaggerLiveTest {
11+
private static final String URL_PREFIX = "http://localhost:8080/spring-security-rest/api";
12+
13+
@Test
14+
public void whenVerifySpringFoxIsWorking_thenOK() {
15+
final Response response = RestAssured.get(URL_PREFIX + "/v2/api-docs");
16+
assertEquals(200, response.statusCode());
17+
System.out.println(response.asString());
18+
19+
}
20+
}

0 commit comments

Comments
 (0)