Reformat code using Eclipse Mars

This commit is contained in:
Phillip Webb
2015-10-07 23:37:10 -07:00
parent e473364e4e
commit c9fb9916b8
408 changed files with 2831 additions and 2652 deletions

View File

@@ -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"));