> +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(' '));
We should have to parse it anyway, as the `filter.getRequestLine`, which is the
only getter that is useful in this case, contains the verb and the protocol
version (something like "GET http://localhost/foo HTTP/1.1").
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/49/files#r9171867