AndroidSdkPreSyncCheck extends AndroidStudioSyncCheck { @Override @NotNull PreSyncCheckResult doCheckCanSyncAndTryToFix(@NotNull Project project) { try { mySdkSync.syncIdeAndProjectAndroidSdks(project); return SUCCESS; } catch (Throwable e) { String msg = "Failed to sync SDKs"; return failure(msg); } } AndroidSdkPreSyncCheck(); @VisibleForTesting  AndroidSdkPreSyncCheck(@NotNull SdkSync sdkSync);   }
@Test public void doCheckCanSyncWithSuccessfulSdkSync() throws IOException { PreSyncCheckResult result = myCondition.doCheckCanSyncAndTryToFix(myProject); assertTrue(result.isSuccess()); verify(mySdkSync).syncIdeAndProjectAndroidSdks(myProject); }
@Test public void doCheckCanSyncWithFailedSdkSync() throws IOException { IOException error = new IOException(); doThrow(error).when(mySdkSync).syncIdeAndProjectAndroidSdks(myProject); PreSyncCheckResult result = myCondition.doCheckCanSyncAndTryToFix(myProject); assertFalse(result.isSuccess()); verify(mySdkSync).syncIdeAndProjectAndroidSdks(myProject); }