com.google.inject.testing.fieldbinder.BoundFieldModule Java Examples
The following examples show how to use
com.google.inject.testing.fieldbinder.BoundFieldModule.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MenuEntrySwapperPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(client.getGameState()).thenReturn(GameState.LOGGED_IN); when(client.getMenuEntries()).thenAnswer((Answer<MenuEntry[]>) invocationOnMock -> { // The menu implementation returns a copy of the array, which causes swap() to not // modify the same array being iterated in onClientTick MenuEntry[] copy = new MenuEntry[entries.length]; System.arraycopy(entries, 0, copy, 0, entries.length); return copy; }); doAnswer((Answer<Void>) invocationOnMock -> { Object argument = invocationOnMock.getArguments()[0]; entries = (MenuEntry[]) argument; return null; }).when(client).setMenuEntries(any(MenuEntry[].class)); menuEntrySwapperPlugin.setupSwaps(); }
Example #2
Source File: ChatFilterPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.CENSOR_WORDS); when(chatFilterConfig.filteredWords()).thenReturn(""); when(chatFilterConfig.filteredRegex()).thenReturn(""); when(chatFilterConfig.filteredNames()).thenReturn(""); when(client.getLocalPlayer()).thenReturn(localPlayer); }
Example #3
Source File: GenericDbBase.java From linstor-server with GNU General Public License v3.0 | 5 votes |
protected void setUpWithoutEnteringScope(Module additionalModule) throws Exception { con = getNewConnection(); errorReporter.logTrace("Running cleanups for next method: %s", testMethodName.getMethodName()); truncateTables(); insertDefaults(con); errorReporter.logTrace("cleanups done, initializing: %s", testMethodName.getMethodName()); MockitoAnnotations.initMocks(this); Mockito.when(mockPeer.getAccessContext()).thenReturn(PUBLIC_CTX); Injector injector = Guice.createInjector( new GuiceConfigModule(), new LoggingModule(errorReporter), new TestSecurityModule(SYS_CTX), new ControllerLinstorModule(), new CoreModule(), new ControllerCoreModule(), new SharedDbConnectionPoolModule(), new TestDbModule(), new ControllerTransactionMgrModule(DatabaseDriverInfo.DatabaseType.SQL), new TestApiModule(), new ControllerSecurityModule(), new ApiCallHandlerModule(), new CtrlConfigModule(new CtrlConfig(null)), additionalModule, BoundFieldModule.of(this) ); injector.getInstance(DbCoreObjProtInitializer.class).initialize(); injector.getInstance(DbDataInitializer.class).initialize(); Mockito.when(layerRscIdPoolMock.autoAllocate()).then(ignoredContext -> layerRscIdAtomicId.getAndIncrement()); injector.injectMembers(this); }
Example #4
Source File: ScreenshotPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(screenshotConfig.screenshotLevels()).thenReturn(true); when(screenshotConfig.screenshotValuableDrop()).thenReturn(true); when(screenshotConfig.screenshotUntradeableDrop()).thenReturn(true); }
Example #5
Source File: MotherlodePluginTest.java From plugins with GNU General Public License v3.0 | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(client.getGameState()).thenReturn(GameState.LOGGED_IN); when(client.getMapRegions()).thenReturn(new int[]{14679}); }
Example #6
Source File: ChatMessageManagerTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); chatMessageManager.loadColors(); }
Example #7
Source File: ItemStatOverlayTest.java From plugins with GNU General Public License v3.0 | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(config.colorBetterUncapped()).thenReturn(new Color(0)); when(config.colorWorse()).thenReturn(new Color(0)); }
Example #8
Source File: XpTrackerPluginTest.java From plugins with GNU General Public License v3.0 | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(client.getLocalPlayer()).thenReturn(mock(Player.class)); xpTrackerPlugin.setXpPanel(mock(XpPanel.class)); }
Example #9
Source File: ChatFilterPluginTest.java From plugins with GNU General Public License v3.0 | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.CENSOR_WORDS); when(chatFilterConfig.filteredWords()).thenReturn(""); when(chatFilterConfig.filteredRegex()).thenReturn(""); when(chatFilterConfig.filteredNames()).thenReturn(""); when(client.getLocalPlayer()).thenReturn(localPlayer); }
Example #10
Source File: RaidsPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(raidsConfig.whitelistedRooms()).thenReturn(""); when(raidsConfig.blacklistedRooms()).thenReturn(""); when(raidsConfig.whitelistedRotations()).thenReturn(""); when(raidsConfig.whitelistedLayouts()).thenReturn(""); }
Example #11
Source File: BankTagsPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); EVENT.setEventName("bankSearchFilter"); when(itemManager.canonicalize(ABYSSAL_WHIP)).thenReturn(ABYSSAL_WHIP); when(client.getIntStackSize()).thenReturn(2); when(client.getStringStackSize()).thenReturn(1); }
Example #12
Source File: KeyRemappingListenerTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void setUp() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(client.getGameState()).thenReturn(GameState.LOGGED_IN); }
Example #13
Source File: GrandExchangePluginTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void setUp() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(client.getUsername()).thenReturn("adam"); when(client.getWorldType()).thenReturn(EnumSet.noneOf(WorldType.class)); }
Example #14
Source File: SpecialCounterPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); // Set up spec weapon ItemContainer equipment = mock(ItemContainer.class); when(equipment.getItem(EquipmentInventorySlot.WEAPON.getSlotIdx())).thenReturn(new Item(ItemID.BANDOS_GODSWORD, 1)); when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(equipment); // Set up special attack energy when(client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT)).thenReturn(100); specialCounterPlugin.onVarbitChanged(new VarbitChanged()); }
Example #15
Source File: ScreenshotPluginTest.java From plugins with GNU General Public License v3.0 | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(screenshotConfig.screenshotLevels()).thenReturn(true); when(screenshotConfig.screenshotValuableDrop()).thenReturn(true); when(screenshotConfig.screenshotUntradeableDrop()).thenReturn(true); }
Example #16
Source File: KeyRemappingListenerTest.java From plugins with GNU General Public License v3.0 | 5 votes |
@Before public void setUp() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(client.getGameState()).thenReturn(GameState.LOGGED_IN); }
Example #17
Source File: XpTrackerPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(client.getLocalPlayer()).thenReturn(mock(Player.class)); xpTrackerPlugin.setXpPanel(mock(XpPanel.class)); }
Example #18
Source File: ItemStatOverlayTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(config.colorBetterUncapped()).thenReturn(new Color(0)); when(config.colorWorse()).thenReturn(new Color(0)); }
Example #19
Source File: PluginManagerTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void before() throws IOException { OkHttpClient okHttpClient = mock(OkHttpClient.class); when(okHttpClient.newCall(any(Request.class))) .thenThrow(new RuntimeException("in plugin manager test")); Injector injector = Guice.createInjector(Modules .override(new RuneLiteModule(okHttpClient, () -> null, true, false, RuneLite.DEFAULT_SESSION_FILE, RuneLite.DEFAULT_CONFIG_FILE)) .with(BoundFieldModule.of(this))); RuneLite.setInjector(injector); // Find plugins and configs we expect to have pluginClasses = new HashSet<>(); configClasses = new HashSet<>(); Set<ClassInfo> classes = ClassPath.from(getClass().getClassLoader()).getTopLevelClassesRecursive(PLUGIN_PACKAGE); for (ClassInfo classInfo : classes) { Class<?> clazz = classInfo.load(); PluginDescriptor pluginDescriptor = clazz.getAnnotation(PluginDescriptor.class); if (pluginDescriptor != null) { pluginClasses.add(clazz); continue; } if (Config.class.isAssignableFrom(clazz)) { configClasses.add(clazz); } } }
Example #20
Source File: GrandExchangePluginTest.java From plugins with GNU General Public License v3.0 | 5 votes |
@Before public void setUp() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(client.getUsername()).thenReturn("adam"); when(client.getWorldType()).thenReturn(EnumSet.noneOf(WorldType.class)); }
Example #21
Source File: MotherlodePluginTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(client.getGameState()).thenReturn(GameState.LOGGED_IN); when(client.getMapRegions()).thenReturn(new int[]{14679}); }
Example #22
Source File: LootTrackerPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void setUp() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); Player player = mock(Player.class); when(player.getWorldLocation()).thenReturn(new WorldPoint(0, 0, 0)); when(client.getLocalPlayer()).thenReturn(player); }
Example #23
Source File: ChatCommandsPluginTest.java From plugins with GNU General Public License v3.0 | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(client.getUsername()).thenReturn(PLAYER_NAME); chatCommandsPlugin.startUp(); }
Example #24
Source File: ChatCommandsPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); when(client.getUsername()).thenReturn(PLAYER_NAME); chatCommandsPlugin.startUp(); }
Example #25
Source File: SpecialCounterPluginTest.java From plugins with GNU General Public License v3.0 | 5 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); // Set up spec weapon ItemContainer equipment = mock(ItemContainer.class); when(equipment.getItem(EquipmentInventorySlot.WEAPON.getSlotIdx())).thenReturn(new Item(ItemID.BANDOS_GODSWORD, 1)); when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(equipment); // Set up special attack energy when(client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT)).thenReturn(100); specialCounterPlugin.onVarbitChanged(new VarbitChanged()); }
Example #26
Source File: EmojiPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); }
Example #27
Source File: ChatNotificationsPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); }
Example #28
Source File: ClueScrollPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); }
Example #29
Source File: TimersPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); }
Example #30
Source File: ConfigManagerTest.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Before public void before() { Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); }