use of com.android.tools.idea.sdk.SdkPaths.ValidationResult in project android by JetBrains.
the class SdkPathsTest method testUnReadableNdkDirectory.
public void testUnReadableNdkDirectory() throws Exception {
File mockFile = mock(File.class);
when(mockFile.getPath()).thenReturn(DUMMY_PATH);
when(mockFile.getAbsolutePath()).thenReturn(DUMMY_PATH);
when(mockFile.isDirectory()).thenReturn(true);
when(mockFile.canRead()).thenReturn(false);
ValidationResult result = validateAndroidNdk(mockFile, false);
assertFalse(result.success);
assertEquals("The path is not readable.", result.message);
result = validateAndroidNdk(mockFile, true);
assertFalse(result.success);
assertEquals(String.format("The path\n'%1$s'\nis not readable.", DUMMY_PATH), result.message);
}
use of com.android.tools.idea.sdk.SdkPaths.ValidationResult in project android by JetBrains.
the class SdkPathsTest method testInvalidNdkDirectory.
public void testInvalidNdkDirectory() throws Exception {
File mockFile = mock(File.class);
when(mockFile.getPath()).thenReturn(DUMMY_PATH);
when(mockFile.getAbsolutePath()).thenReturn(DUMMY_PATH);
when(mockFile.isDirectory()).thenReturn(false);
ValidationResult result = validateAndroidNdk(mockFile, false);
assertFalse(result.success);
assertEquals("The path does not belong to a directory.", result.message);
result = validateAndroidNdk(mockFile, true);
assertFalse(result.success);
assertEquals(String.format("The path\n'%1$s'\ndoes not belong to a directory.", DUMMY_PATH), result.message);
}
use of com.android.tools.idea.sdk.SdkPaths.ValidationResult in project android by JetBrains.
the class SdkPathsTest method testValidSdkDirectory.
public void testValidSdkDirectory() throws Exception {
tmpDir = createTempDirectory(SdkPathsTest.class.getName(), "testValidSdkDirectory");
createDirectory(new File(tmpDir, "platforms"));
ValidationResult result = validateAndroidSdk(tmpDir, false);
assertTrue(result.success);
result = validateAndroidSdk(tmpDir, true);
assertTrue(result.success);
}
Aggregations