Revision: cd12655357bc
Author: Sam Berlin <[email protected]>
Date: Sun May 27 10:38:30 2012
Log: Don't assume methods will be in order when asserting error
messages.
Revision created by MOE tool push_codebase.
MOE_MIGRATION=4873
http://code.google.com/p/google-guice/source/detail?r=cd12655357bc
Modified:
/extensions/assistedinject/test/com/google/inject/assistedinject/FactoryProvider2Test.java
=======================================
---
/extensions/assistedinject/test/com/google/inject/assistedinject/FactoryProvider2Test.java
Thu Jul 7 17:34:16 2011
+++
/extensions/assistedinject/test/com/google/inject/assistedinject/FactoryProvider2Test.java
Sun May 27 10:38:30 2012
@@ -575,22 +575,28 @@
});
fail();
} catch (CreationException expected) {
+ assertEquals(expected.getMessage(), 4,
expected.getErrorMessages().size());
+ // Assert each method individually, because JDK7 doesn't guarantee
method ordering.
assertContains(expected.getMessage(),
- "1) A Provider may not be a type in a factory method of an
AssistedInject."
+ ") A Provider may not be a type in a factory method of an
AssistedInject."
+ "\n Offending instance is parameter [1] with key"
+ " [com.google.inject.Provider<" + Color.class.getName()
+ ">] on method ["
- + ProviderBasedColoredCarFactory.class.getName()
+ ".createCar()]",
- "2) A Provider may not be a type in a factory method of an
AssistedInject."
+ + ProviderBasedColoredCarFactory.class.getName()
+ ".createCar()]");
+ assertContains(expected.getMessage(),
+ ") A Provider may not be a type in a factory method of an
AssistedInject."
+ "\n Offending instance is parameter [2] with key"
+ " [com.google.inject.Provider<java.lang.String>] on method ["
- + ProviderBasedColoredCarFactory.class.getName()
+ ".createCar()]",
- "3) A Provider may not be a type in a factory method of an
AssistedInject."
+ + ProviderBasedColoredCarFactory.class.getName()
+ ".createCar()]");
+ assertContains(expected.getMessage(),
+ ") A Provider may not be a type in a factory method of an
AssistedInject."
+ "\n Offending instance is parameter [1] with key"
+ " [com.google.inject.Provider<" + Color.class.getName() + ">"
+ " annotated with
@com.google.inject.assistedinject.Assisted(value=color)]"
+ " on method [" +
ProviderBasedColoredCarFactory.class.getName() + ".createMustang()]"
);
-
+ assertContains(expected.getMessage(),
+ ") No implementation for com.google.inject.assistedinject."
+ + "FactoryProvider2Test$ProviderBasedColoredCarFactory was
bound.");
}
}
@@ -609,21 +615,27 @@
});
fail();
} catch (CreationException expected) {
+ assertEquals(expected.getMessage(), 4,
expected.getErrorMessages().size());
assertContains(expected.getMessage(),
- "1) A Provider may not be a type in a factory method of an
AssistedInject."
+ ") A Provider may not be a type in a factory method of an
AssistedInject."
+ "\n Offending instance is parameter [1] with key"
+ " [com.google.inject.Provider<" + Color.class.getName()
+ ">] on method ["
- + JavaxProviderBasedColoredCarFactory.class.getName()
+ ".createCar()]",
- "2) A Provider may not be a type in a factory method of an
AssistedInject."
+ + JavaxProviderBasedColoredCarFactory.class.getName()
+ ".createCar()]");
+ assertContains(expected.getMessage(),
+ ") A Provider may not be a type in a factory method of an
AssistedInject."
+ "\n Offending instance is parameter [2] with key"
+ " [com.google.inject.Provider<java.lang.String>] on method ["
- + JavaxProviderBasedColoredCarFactory.class.getName()
+ ".createCar()]",
- "3) A Provider may not be a type in a factory method of an
AssistedInject."
+ + JavaxProviderBasedColoredCarFactory.class.getName()
+ ".createCar()]");
+ assertContains(expected.getMessage(),
+ ") A Provider may not be a type in a factory method of an
AssistedInject."
+ "\n Offending instance is parameter [1] with key"
+ " [com.google.inject.Provider<" + Color.class.getName() + ">"
+ " annotated with
@com.google.inject.assistedinject.Assisted(value=color)]"
+ " on method [" +
JavaxProviderBasedColoredCarFactory.class.getName() + ".createMustang()]"
);
+ assertContains(expected.getMessage(),
+ ") No implementation for com.google.inject.assistedinject."
+ + "FactoryProvider2Test$JavaxProviderBasedColoredCarFactory
was bound.");
}
}
--
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.