simplify servlet SPI test.
git-svn-id: https://google-guice.googlecode.com/svn/trunk@1371 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/extensions/servlet/test/com/google/inject/servlet/ServletSpiVisitor.java b/extensions/servlet/test/com/google/inject/servlet/ServletSpiVisitor.java
index ac46f9f..0a2ec59 100644
--- a/extensions/servlet/test/com/google/inject/servlet/ServletSpiVisitor.java
+++ b/extensions/servlet/test/com/google/inject/servlet/ServletSpiVisitor.java
@@ -72,22 +72,22 @@
}
public Integer visit(InstanceFilterBinding binding) {
- actual.add(new Params(binding.getPattern(), binding.getFilterInstance(), binding.getInitParams(), binding.getUriPatternType()));
+ actual.add(new Params(binding, binding.getFilterInstance()));
return currentCount++;
}
public Integer visit(InstanceServletBinding binding) {
- actual.add(new Params(binding.getPattern(), binding.getServletInstance(), binding.getInitParams(), binding.getUriPatternType()));
+ actual.add(new Params(binding, binding.getServletInstance()));
return currentCount++;
}
public Integer visit(LinkedFilterBinding binding) {
- actual.add(new Params(binding.getPattern(), binding.getLinkedKey(), binding.getInitParams(), binding.getUriPatternType()));
+ actual.add(new Params(binding, binding.getLinkedKey()));
return currentCount++;
}
public Integer visit(LinkedServletBinding binding) {
- actual.add(new Params(binding.getPattern(), binding.getLinkedKey(), binding.getInitParams(), binding.getUriPatternType()));
+ actual.add(new Params(binding, binding.getLinkedKey()));
return currentCount++;
}
@@ -104,7 +104,14 @@
private final String pattern;
private final Object keyOrInstance;
private final Map<String, String> params;
- private UriPatternType patternType;
+ private final UriPatternType patternType;
+
+ Params(ServletModuleBinding binding, Object keyOrInstance) {
+ this.pattern = binding.getPattern();
+ this.keyOrInstance = keyOrInstance;
+ this.params = binding.getInitParams();
+ this.patternType = binding.getUriPatternType();
+ }
Params(String pattern, Object keyOrInstance, Map params, UriPatternType patternType) {
this.pattern = pattern;
@@ -125,7 +132,7 @@
return false;
}
}
-
+
@Override
public int hashCode() {
return Objects.hashCode(pattern, keyOrInstance, params, patternType);