Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InjectedTest does not add the LifeCycle module and has no provision for adding modules (Bugzilla Bug 428240) #18

Open
mcculls opened this issue Oct 25, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@mcculls
Copy link
Contributor

mcculls commented Oct 25, 2021

This issue was created automatically with bugzilla2github

Bugzilla Bug 428240

Date: 2014-02-14 21:11:02 -0500
From: benson margulies <bimargulies@gmail.com>
To: Project Inbox <sisu-inbox@eclipse.org>
CC: mcculls@gmail.com

Last updated: 2014-02-15 11:57:31 -0500

Comment 2363728

Date: 2014-02-14 21:11:02 -0500
From: benson margulies <bimargulies@gmail.com>

I can't seem to make a test using InjectedTest that depends on the LifecycleModule.

Comment 2363730

Date: 2014-02-14 21:22:25 -0500
From: benson margulies <bimargulies@gmail.com>

From 53144e70a07346cd8b5ee45b2fa4a00580caca9a Mon Sep 17 00:00:00 2001
From: Benson Margulies <benson@basistech.com>
Date: Fri, 14 Feb 2014 21:20:03 -0500
Subject: [PATCH] Bug #428240: add ability to add modules, like
 LifecycleModule(), to InjectedTest.

---
 .../src/org/eclipse/sisu/launch/InjectedTest.java                   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/org.eclipse.sisu.inject/src/org/eclipse/sisu/launch/InjectedTest.java b/org.eclipse.sisu.inject/src/org/eclipse/sisu/launch/InjectedTest.java
index 45f2011..8b6284a 100644
--- a/org.eclipse.sisu.inject/src/org/eclipse/sisu/launch/InjectedTest.java
+++ b/org.eclipse.sisu.inject/src/org/eclipse/sisu/launch/InjectedTest.java
@@ -56,12 +56,16 @@ public abstract class InjectedTest
     // Setup
     // ----------------------------------------------------------------------

+    protected Module setUpModule() {
+        return new SetUpModule();
+    }
+
     @Before
     @BeforeMethod
     public void setUp()
         throws Exception
     {
-        Guice.createInjector( new WireModule( new SetUpModule(), spaceModule() ) );
+        Guice.createInjector( new WireModule( setUpModule(), spaceModule() ) );
     }

     @After
--
1.8.3.4 (Apple Git-47)

Comment 2363786

Date: 2014-02-15 11:19:36 -0500
From: Stuart McCulloch <mcculls@gmail.com>

Note you can use the configure(Binder) method to add bindings or install modules:

    @Override
    public void configure( Binder binder )
    {
        binder.install( new LifecycleModule() );
    }

There's also a configure(Properties) method for setting custom properties.

Comment 2363789

Date: 2014-02-15 11:29:12 -0500
From: benson margulies <bimargulies@gmail.com>

It sure would be nice if configure was an annotated method instead of an overridden method so that a test base class could have one and then subclasses could have them too.

Comment 2363795

Date: 2014-02-15 11:54:51 -0500
From: Stuart McCulloch <mcculls@gmail.com>

Not sure what you mean by annotated method in this situation. The base test class and sub classes can all have configure(Binder) methods, they just need to remember to call the "super" method as usual if they want to inherit previous configurations.

Comment 2363796

Date: 2014-02-15 11:57:31 -0500
From: benson margulies <bimargulies@gmail.com>

It's the 'super' calls I'm being whiny about.

Imagine an @Configure that works like @Before, so that you wouldn't have to.

I'll make a patch if it bothers me enough.

Meanwhile, this patch looks pretty much useless now.

@mcculls mcculls added the bug Something isn't working label Oct 25, 2021
@mcculls mcculls added enhancement New feature or request and removed bug Something isn't working labels Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant