Reformat code using Eclipse Mars
This commit is contained in:
@@ -85,23 +85,22 @@ public class SampleSecureOAuth2ApplicationTests {
|
||||
public void useAppSecretsPlusUserAccountToGetBearerToken() throws Exception {
|
||||
String header = "Basic " + new String(Base64.encode("foo:bar".getBytes()));
|
||||
MvcResult result = this.mvc
|
||||
.perform(
|
||||
post("/oauth/token").header("Authorization", header)
|
||||
.param("grant_type", "password").param("scope", "read")
|
||||
.param("username", "greg").param("password", "turnquist"))
|
||||
.perform(post("/oauth/token").header("Authorization", header)
|
||||
.param("grant_type", "password").param("scope", "read")
|
||||
.param("username", "greg").param("password", "turnquist"))
|
||||
.andExpect(status().isOk()).andDo(print()).andReturn();
|
||||
Object accessToken = this.objectMapper.readValue(
|
||||
result.getResponse().getContentAsString(), Map.class).get("access_token");
|
||||
Object accessToken = this.objectMapper
|
||||
.readValue(result.getResponse().getContentAsString(), Map.class)
|
||||
.get("access_token");
|
||||
MvcResult flightsAction = this.mvc
|
||||
.perform(
|
||||
get("/flights/1").accept(MediaTypes.HAL_JSON).header(
|
||||
"Authorization", "Bearer " + accessToken))
|
||||
.perform(get("/flights/1").accept(MediaTypes.HAL_JSON)
|
||||
.header("Authorization", "Bearer " + accessToken))
|
||||
.andExpect(
|
||||
header().string("Content-Type", MediaTypes.HAL_JSON.toString()))
|
||||
.andExpect(status().isOk()).andDo(print()).andReturn();
|
||||
|
||||
Flight flight = this.objectMapper.readValue(flightsAction.getResponse()
|
||||
.getContentAsString(), Flight.class);
|
||||
Flight flight = this.objectMapper.readValue(
|
||||
flightsAction.getResponse().getContentAsString(), Flight.class);
|
||||
|
||||
assertThat(flight.getOrigin(), is("Nashville"));
|
||||
assertThat(flight.getDestination(), is("Dallas"));
|
||||
|
||||
Reference in New Issue
Block a user