Use AssertJ in spring-boot-samples
See gh-5083
This commit is contained in:
@@ -35,7 +35,7 @@ import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Basic integration tests for demo application.
|
||||
@@ -70,25 +70,25 @@ public class SampleSecureApplicationTests {
|
||||
|
||||
@Test(expected = AuthenticationException.class)
|
||||
public void secure() throws Exception {
|
||||
assertEquals(this.service.secure(), "Hello Security");
|
||||
assertThat("Hello Security").isEqualTo(this.service.secure());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void authenticated() throws Exception {
|
||||
SecurityContextHolder.getContext().setAuthentication(this.authentication);
|
||||
assertEquals(this.service.secure(), "Hello Security");
|
||||
assertThat("Hello Security").isEqualTo(this.service.secure());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void preauth() throws Exception {
|
||||
SecurityContextHolder.getContext().setAuthentication(this.authentication);
|
||||
assertEquals(this.service.authorized(), "Hello World");
|
||||
assertThat("Hello World").isEqualTo(this.service.authorized());
|
||||
}
|
||||
|
||||
@Test(expected = AccessDeniedException.class)
|
||||
public void denied() throws Exception {
|
||||
SecurityContextHolder.getContext().setAuthentication(this.authentication);
|
||||
assertEquals(this.service.denied(), "Goodbye World");
|
||||
assertThat("Goodbye World").isEqualTo(this.service.denied());
|
||||
}
|
||||
|
||||
@PropertySource("classpath:test.properties")
|
||||
|
||||
Reference in New Issue
Block a user