-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make getSdkPath and getJavaToolsJar public. (#164)
* Make getSdkPath public for testing. * Fixes an issue with resolving paths in CloudSdk and adds unit tests. * Replaced toFile() with Files.isDirectory()/isRegularFile().
- Loading branch information
1 parent
e28a3e8
commit 9d7b30f
Showing
2 changed files
with
85 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...ne-plugins-core/src/test/java/com/google/cloud/tools/appengine/cloudsdk/CloudSdkTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.google.cloud.tools.appengine.cloudsdk; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
|
||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
/** | ||
* Unit tests for {@link CloudSdk} | ||
*/ | ||
@RunWith(MockitoJUnitRunner.class) | ||
public class CloudSdkTest { | ||
@Test | ||
public void testGetSdkPath() { | ||
Path location = Paths.get("/"); | ||
CloudSdk sdk = new CloudSdk.Builder().sdkPath(location).build(); | ||
assertEquals(location, sdk.getSdkPath()); | ||
} | ||
|
||
@Test | ||
public void testGetJavaAppEngineSdkPath() { | ||
Path location = Paths.get("/"); | ||
CloudSdk sdk = new CloudSdk.Builder().sdkPath(location).build(); | ||
assertEquals(location.resolve("platform/google_appengine/google/appengine/tools/java/lib"), | ||
sdk.getJavaAppEngineSdkPath()); | ||
} | ||
|
||
@Test | ||
public void testGetJarPathJavaTools() { | ||
Path location = Paths.get("/"); | ||
CloudSdk sdk = new CloudSdk.Builder().sdkPath(location).build(); | ||
assertEquals(Paths.get("/platform/google_appengine/google/appengine" | ||
+ "/tools/java/lib/appengine-tools-api.jar"), | ||
sdk.getJarPath("appengine-tools-api.jar")); | ||
} | ||
} |