The integration test we wrote for the service earlier will start failing because of invalid credentials. We will now update the integration test to supply basic authentication credentials:
private TestRestTemplate template = new TestRestTemplate(); HttpHeaders headers = createHeaders("user-name", "user-password"); HttpHeaders createHeaders(String username, String password) { return new HttpHeaders() { { String auth = username + ":" + password; byte[] encodedAuth = Base64.getEncoder().encode (auth.getBytes(Charset.forName("US-ASCII"))); String authHeader = "Basic " + new String(encodedAuth); set("Authorization", authHeader); } }; } @Test public void retrieveTodos() throws Exception { String expected = "[" + "{id:1,user:Jack,desc:\"Learn ...