Author: limpbizkit
Date: Mon Mar 30 17:22:56 2009
New Revision: 920
Added:
trunk/test/com/google/inject/spi/ElementApplyToTest.java
- copied, changed from r915,
/trunk/test/com/google/inject/spi/ModuleWriterTest.java
Log:
A new test to verify that our new Element.applyTo() API is repeatable. This
currently includes one failing test for private modules...
Copied: trunk/test/com/google/inject/spi/ElementApplyToTest.java (from
r915, /trunk/test/com/google/inject/spi/ModuleWriterTest.java)
==============================================================================
--- /trunk/test/com/google/inject/spi/ModuleWriterTest.java (original)
+++ trunk/test/com/google/inject/spi/ElementApplyToTest.java Mon Mar 30
17:22:56 2009
@@ -16,22 +16,27 @@
package com.google.inject.spi;
+import com.google.inject.AbstractModule;
import com.google.inject.Module;
import java.util.List;
-
/**
* @author [email protected] (Jesse Wilson)
*/
-public class ModuleWriterTest extends ElementsTest {
+public class ElementApplyToTest extends ElementsTest {
protected void checkModule(Module module, ElementVisitor<?>... visitors)
{
// get some elements to apply
- List<Element> elements = Elements.getElements(module);
+ final List<Element> elements = Elements.getElements(module);
- // apply the recorded elements, and record them again!
- List<Element> rewrittenElements
- = Elements.getElements(new ModuleWriter().create(elements));
+ // apply the elements, and extract them again!
+ List<Element> rewrittenElements = Elements.getElements(new
AbstractModule() {
+ protected void configure() {
+ for (Element element : elements) {
+ element.applyTo(binder());
+ }
+ }
+ });
// verify that the replayed elements are as expected
assertEquals(rewrittenElements.size(), visitors.length);
@@ -41,4 +46,4 @@
element.acceptVisitor(visitor);
}
}
-}
+}
\ No newline at end of file
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en
-~----------~----~----~----~------~----~------~--~---