ActionLoopEnable extends Action { @Override public void doAction(Callback callback) { if (!LoopPlugin.getPlugin().isEnabled(PluginType.LOOP)) { LoopPlugin.getPlugin().setPluginEnabled(PluginType.LOOP, true); ConfigBuilderPlugin.getPlugin().storeSettings("ActionLoopEnable"); RxBus.INSTANCE.send(new EventRefreshOverview("ActionLoopEnable")); if (callback != null) callback.result(new PumpEnactResult().success(true).comment(R.string.ok)).run(); } else { if (callback != null) callback.result(new PumpEnactResult().success(true).comment(R.string.alreadyenabled)).run(); } }  @Override int friendlyName(); @Override String shortDescription(); @Override void doAction(Callback callback); @Override Optional<Integer> icon();  }
@Test public void doActionTest() { LoopPlugin.getPlugin().setPluginEnabled(PluginType.LOOP, false); actionLoopEnable.doAction(new Callback() { @Override public void run() { } }); Assert.assertEquals(true, LoopPlugin.getPlugin().isEnabled(PluginType.LOOP)); actionLoopEnable.doAction(new Callback() { @Override public void run() { } }); Assert.assertEquals(true, LoopPlugin.getPlugin().isEnabled(PluginType.LOOP)); }