> +public class AuthenticationFilterTest {
> +
> + @Test(expectedExceptions = NullPointerException.class,
> expectedExceptionsMessageRegExp = "credential supplier cannot be null")
> + public void testFilterWithoutCredentials() {
> + new AuthenticationFilter(null);
> + }
> +
> + public void testFilterWithCredentials() {
> + HttpRequest request =
> HttpRequest.builder().method("GET").endpoint("htto://localhost/foo").build();
> + Credentials credentials =
> LoginCredentials.builder().identity("foo").credential("bar").build();
> + AuthenticationFilter filter = new
> AuthenticationFilter(Suppliers.ofInstance(credentials));
> +
> + HttpRequest filtered = filter.filter(request);
> +
> + String queryLine = filtered.getRequestLine().trim()
> + .substring(filtered.getRequestLine().indexOf('?') + 1,
> filtered.getRequestLine().lastIndexOf(' '));
What are we extracting here? Easier to do with URL or URI or one of the
builders?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/49/files#r9166778