### Question:
VersionControlCheckOutAction extends VersionControlAction { protected void checkOut(Collection<DomainFile> providedList) { if (!checkRepositoryConnected()) { return; } doCheckOut(providedList); } VersionControlCheckOutAction(Plugin plugin);   VersionControlCheckOutAction(String owner, PluginTool tool); @Override void actionPerformed(DomainFileProvider context); @Override boolean isEnabledForContext(DomainFileProvider context);  }### Answer:
@Test public void testCheckOut_OnlyUnversionedFiles() { DummyPluginTool tool = new DummyPluginTool(); VersionControlCheckOutAction action = new VersionControlCheckOutAction("owner", tool); spyLogger.reset(); spyDisplay.reset(); checkout(action, unversioned); waitForTasks(); assertNoLoggedMessages(); spyDisplay.assertDisplayMessage("No", "versioned", "files"); }
@Test public void testCheckOut_OnlyVersionedAndNotCheckedOutFiles_ConfirmCheckout() { DummyPluginTool tool = new DummyPluginTool(); VersionControlCheckOutAction action = new VersionControlCheckOutAction("owner", tool); spyLogger.reset(); spyDisplay.reset(); checkout(action, notCheckedOut); confirmCheckout(); waitForTasks(); spyLogger.assertLogMessage("Checkout", "completed", Integer.toString(notCheckedOut.size())); assertNoDisplayedMessages(); }
@Test public void testCheckOut_OnlyVersionedAndNotCheckedOutFiles_CancelCheckout() { DummyPluginTool tool = new DummyPluginTool(); VersionControlCheckOutAction action = new VersionControlCheckOutAction("owner", tool); spyLogger.reset(); spyDisplay.reset(); checkout(action, notCheckedOut); cancelCheckout(); waitForTasks(); assertNoLoggedMessages(); assertNoDisplayedMessages(); }
@Test public void testCheckOut_OnlyVersionedAndCheckedOutFiles() { DummyPluginTool tool = new DummyPluginTool(); VersionControlCheckOutAction action = new VersionControlCheckOutAction("owner", tool); spyLogger.reset(); spyDisplay.reset(); checkout(action, checkedOut); waitForTasks(); assertNoLoggedMessages(); spyDisplay.assertDisplayMessage("No", "versioned", "files"); }
@Test public void testCheckOut_OnlyVersionedFilesThatFailCheckout() { DummyPluginTool tool = new DummyPluginTool(); VersionControlCheckOutAction action = new VersionControlCheckOutAction("owner", tool); spyLogger.reset(); spyDisplay.reset(); checkout(action, failToCheckout); confirmCheckout(); waitForTasks(); spyDisplay.assertDisplayMessage("Multiple", "checkouts", "failed"); }
@Test public void testCheckOut_MixOfVersionedFilesThatDoAndDontFailCheckout() { DummyPluginTool tool = new DummyPluginTool(); VersionControlCheckOutAction action = new VersionControlCheckOutAction("owner", tool); spyLogger.reset(); spyDisplay.reset(); Set<DomainFile> mixed = new HashSet<>(); mixed.add(CollectionUtils.any(notCheckedOut)); mixed.add(CollectionUtils.any(failToCheckout)); checkout(action, mixed); confirmCheckout(); waitForTasks(); spyDisplay.assertDisplayMessage("Exclusive", "checkout", "failed"); }
@Test public void testCheckOut_SingleVersionedAndNotCheckedOutFile() { DummyPluginTool tool = new DummyPluginTool(); VersionControlCheckOutAction action = new VersionControlCheckOutAction("owner", tool); spyLogger.reset(); spyDisplay.reset(); Set<DomainFile> file = new HashSet<>(); file.add(CollectionUtils.any(notCheckedOut)); checkout(action, file); waitForTasks(); spyLogger.assertLogMessage("Checkout", "completed", "1"); assertNoDisplayedMessages(); }