FreezeAction implements Action { @Override public Object execute() throws Exception { switch (mode) { case enable: freezeService.requestFreeze("console request"); break; case release: freezeService.cancelFreeze(); break; } return null; } @Inject  FreezeAction(final FreezeService freezeService); @Override Object execute();  }
@Test public void executeFreeze() throws Exception { underTest.execute(); verify(freezeService).requestFreeze(isA(String.class)); verify(freezeService, never()).cancelFreeze(); }
@Test public void executeRelease() throws Exception { underTest.mode = Mode.release; underTest.execute(); verify(freezeService, never()).requestFreeze(isA(String.class)); verify(freezeService).cancelFreeze(); }