-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrote the "child binding already set" error message for better clar…
…ity. PiperOrigin-RevId: 698811431
- Loading branch information
Showing
8 changed files
with
35 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,9 @@ | |
import org.junit.runner.RunWith; | ||
import org.junit.runners.JUnit4; | ||
|
||
/** @author [email protected] (Jesse Wilson) */ | ||
/** | ||
* @author [email protected] (Jesse Wilson) | ||
*/ | ||
@RunWith(JUnit4.class) | ||
public class ParentInjectorTest { | ||
|
||
|
@@ -70,8 +72,10 @@ public void testParentJitBindingWontClobberChildBinding() { | |
} catch (ConfigurationException e) { | ||
assertContains( | ||
e.getMessage(), | ||
"Unable to create binding for ParentInjectorTest$A because it was already configured on" | ||
+ " one or more child injectors or private modules.", | ||
"A binding for ParentInjectorTest$A already exists in one or more child injectors or" | ||
+ " private modules. Bindings from children can only be used by a parent if the child" | ||
+ " was a PrivateModule and the binding was exposed. Parent injectors cannot create" | ||
+ " bindings that already exist in a child.", | ||
"ParentInjectorTest$9.configure"); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,9 @@ | |
import java.util.List; | ||
import junit.framework.TestCase; | ||
|
||
/** @author [email protected] (Jesse Wilson) */ | ||
/** | ||
* @author [email protected] (Jesse Wilson) | ||
*/ | ||
public class PrivateModuleTest extends TestCase { | ||
|
||
public void testBasicUsage() { | ||
|
@@ -589,8 +591,10 @@ public void testParentBindsSomethingInPrivate() { | |
assertEquals(1, expected.getErrorMessages().size()); | ||
assertContains( | ||
expected.toString(), | ||
"Unable to create binding for List<String> ", | ||
"because it was already configured on one or more child injectors or private modules.", | ||
"A binding for List<String> already exists in one or more child injectors", | ||
" or private modules. Bindings from children can only be used by a parent if the child", | ||
" was a PrivateModule and the binding was exposed. Parent injectors cannot create", | ||
" bindings that already exist in a child.", | ||
"1 : PrivateModuleTest$FailingPrivateModule.configure", | ||
"PrivateModuleTest$FailingModule -> PrivateModuleTest$ManyPrivateModules ->" | ||
+ " PrivateModuleTest$FailingPrivateModule", | ||
|
@@ -610,8 +614,10 @@ public void testParentBindingToPrivateLinkedJitBinding() { | |
assertEquals(1, expected.getErrorMessages().size()); | ||
assertContains( | ||
expected.toString(), | ||
"Unable to create binding for List<String> because it was already configured on one or" | ||
+ " more child injectors or private modules", | ||
"A binding for List<String> already exists in one or more child injectors", | ||
" or private modules. Bindings from children can only be used by a parent if the child", | ||
" was a PrivateModule and the binding was exposed. Parent injectors cannot create", | ||
" bindings that already exist in a child.", | ||
"1 : PrivateModuleTest$FailingPrivateModule.configure", | ||
"PrivateModuleTest$ManyPrivateModules -> PrivateModuleTest$FailingPrivateModule", | ||
"2 : PrivateModuleTest$SecondFailingPrivateModule.configure", | ||
|
@@ -628,8 +634,10 @@ public void testParentBindingToPrivateJitBinding() { | |
assertEquals(1, expected.getErrorMessages().size()); | ||
assertContains( | ||
expected.toString(), | ||
"Unable to create binding for PrivateModuleTest$PrivateFoo because it was already" | ||
+ " configured on one or more child injectors or private modules.", | ||
"A binding for PrivateModuleTest$PrivateFoo already exists in one or more child", | ||
" injectors or private modules. Bindings from children can only be used by a parent if", | ||
" the child was a PrivateModule and the binding was exposed. Parent injectors cannot", | ||
" create bindings that already exist in a child.", | ||
"as a just-in-time binding"); | ||
} | ||
} | ||
|
2 changes: 1 addition & 1 deletion
2
...t/com/google/inject/errors/testdata/child_binding_already_set_by_just_in_time_binding.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
core/test/com/google/inject/errors/testdata/child_binding_already_set_error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...test/com/google/inject/errors/testdata/child_binding_already_set_multiple_times_error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
core/test/com/google/inject/errors/testdata/multiple_child_binding_already_set_errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters