add swagger test

This commit is contained in:
DOHA 2016-05-30 11:48:04 +02:00
parent 27c1ed3189
commit 46cc39ed23
2 changed files with 21 additions and 1 deletions

View File

@ -44,7 +44,7 @@ public class SecurityJavaConfig extends WebSecurityConfigurerAdapter {
.authorizeRequests() .authorizeRequests()
.antMatchers("/api/csrfAttacker*").permitAll() .antMatchers("/api/csrfAttacker*").permitAll()
.antMatchers("/api/customer/**").permitAll() .antMatchers("/api/customer/**").permitAll()
.antMatchers("/api/**").authenticated() .antMatchers("/api/foos/**").authenticated()
.and() .and()
.formLogin() .formLogin()
.successHandler(authenticationSuccessHandler) .successHandler(authenticationSuccessHandler)

View File

@ -0,0 +1,20 @@
package org.baeldung.web;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
public class SwaggerLiveTest {
private static final String URL_PREFIX = "http://localhost:8080/spring-security-rest/api";
@Test
public void whenVerifySpringFoxIsWorking_thenOK() {
final Response response = RestAssured.get(URL_PREFIX + "/v2/api-docs");
assertEquals(200, response.statusCode());
System.out.println(response.asString());
}
}