ActionLoopDisable extends Action { @Override public void doAction(Callback callback) { if (LoopPlugin.getPlugin().isEnabled(PluginType.LOOP)) { LoopPlugin.getPlugin().setPluginEnabled(PluginType.LOOP, false); ConfigBuilderPlugin.getPlugin().storeSettings("ActionLoopDisable"); ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() { @Override public void run() { RxBus.INSTANCE.send(new EventRefreshOverview("ActionLoopDisable")); if (callback != null) callback.result(result).run(); } }); } else { if (callback != null) callback.result(new PumpEnactResult().success(true).comment(R.string.alreadydisabled)).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, true); actionLoopDisable.doAction(new Callback() { @Override public void run() { } }); Assert.assertEquals(false, LoopPlugin.getPlugin().isEnabled(PluginType.LOOP)); actionLoopDisable.doAction(new Callback() { @Override public void run() { } }); Assert.assertEquals(false, LoopPlugin.getPlugin().isEnabled(PluginType.LOOP)); }