Skip to content

Commit

Permalink
Removed Preconditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Schönborn committed May 13, 2016
1 parent 9c5e80a commit 1f838f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

import static com.google.common.base.Preconditions.checkArgument;
import static java.lang.String.format;

interface HttpFilter extends Filter {

Expand All @@ -43,8 +43,13 @@ default void init(final FilterConfig filterConfig) throws ServletException {
default void doFilter(final ServletRequest request, final ServletResponse response,
final FilterChain chain) throws ServletException, IOException {

checkArgument(request instanceof HttpServletRequest, "%s only supports HTTP", getClass().getSimpleName());
checkArgument(response instanceof HttpServletResponse, "%s only supports HTTP", getClass().getSimpleName());
if (!(request instanceof HttpServletRequest)) {
throw new IllegalArgumentException(format("%s only supports HTTP", getClass().getSimpleName()));
}

if (!(response instanceof HttpServletResponse)) {
throw new IllegalArgumentException(format("%s only supports HTTP", getClass().getSimpleName()));
}

final HttpServletRequest httpRequest = (HttpServletRequest) request;
final HttpServletResponse httpResponse = (HttpServletResponse) response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@

import javax.annotation.Nullable;

import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.Objects.requireNonNull;

interface MockHttpMessage {

default <K, V> ListMultimap<K, V> firstNonNullNorEmpty(@Nullable final ListMultimap<K, V> first,
final ListMultimap<K, V> second) {
return first != null && !first.isEmpty() ? first : checkNotNull(second);
return first != null && !first.isEmpty() ? first : requireNonNull(second);
}

}

0 comments on commit 1f838f6

Please sign in to comment.