Change delayed injection to only change behavior of its own elements
- Introduce new BeforeInjecting annotation to not modify the (expected) order of annotations that do not belong to us - Avoids using hacky way of first initializing field to an Answer that will delegate on demand to the proper class... - Remove PostConstruct support for Mockito's InjectMocks: we should not change the established behavior of external elements
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
package fr.xephi.authme.command;
|
||||
|
||||
import fr.xephi.authme.DelayedInject;
|
||||
import fr.xephi.authme.DelayedInjectionRunner;
|
||||
import fr.xephi.authme.command.TestCommandsUtil.TestLoginCommand;
|
||||
import fr.xephi.authme.command.TestCommandsUtil.TestRegisterCommand;
|
||||
import fr.xephi.authme.command.TestCommandsUtil.TestUnregisterCommand;
|
||||
import fr.xephi.authme.command.executable.HelpCommand;
|
||||
import fr.xephi.authme.permission.PermissionNode;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.runner.BeforeInjecting;
|
||||
import fr.xephi.authme.runner.InjectDelayed;
|
||||
import fr.xephi.authme.runner.DelayedInjectionRunner;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -41,7 +41,7 @@ public class CommandMapperTest {
|
||||
|
||||
private static Set<CommandDescription> commands;
|
||||
|
||||
@DelayedInject
|
||||
@InjectDelayed
|
||||
private CommandMapper mapper;
|
||||
|
||||
@Mock
|
||||
@@ -55,7 +55,7 @@ public class CommandMapperTest {
|
||||
commands = TestCommandsUtil.generateCommands();
|
||||
}
|
||||
|
||||
@Before
|
||||
@BeforeInjecting
|
||||
public void setUpMocks() {
|
||||
given(commandInitializer.getCommands()).willReturn(commands);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user