BasicRequest { BasicResponse get(SwarmConfig config, String path) throws IOException, UnauthorizedAccessException { return get(config, path, null); } BasicRequest();   BasicRequest(HttpClientRequester httpClientRequester);   }
@Test void get_path_401() throws IOException { MockHttpRequester mock = new MockHttpRequester(); mock.withCall() .expectsRequest((HttpUriRequest r) -> assertThat("bad URL", r.getURI().toASCIIString(), is("http: .withResponse(401, "Invalid Credentials", "x-application/json", "{}"); BasicRequest req = new BasicRequest(mock); try { req.get(createConfig(), "version"); fail("Did not throw UnauthorizedAccessException"); } catch (UnauthorizedAccessException e) { assertThat(e.getMessage(), is("Invalid Credentials")); } }