Class TestGitHubApis
- java.lang.Object
-
- com.damnhandy.uri.template.examples.AbstractExampleTest
-
- com.damnhandy.uri.template.examples.TestGitHubApis
-
public class TestGitHubApis extends AbstractExampleTest
Some simple tests to format
UriTemplate
for the various GitHub APIs. This test assumes that the following system properties are set:-Dgithub.username=
-Dgithub.password= If the properties are set, the test will not fail the build.
This test demonstrates the utility of a single URI template that can be used to express the majority of the functionality offered by the GitHub API. For this test, the following template expression is used:
/repos{/user,repo,function,id}{?page,per_page}
- Version:
- $Revision: 1.1 $
- Author:
- Ryan J. McDonough
-
-
Field Summary
Fields Modifier and Type Field Description static String
BASE
static String
PAGINATION
static String
PATH_EXPRESSION
-
Constructor Summary
Constructors Constructor Description TestGitHubApis()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.ning.http.client.AsyncHttpClient
createClient()
static void
setUp()
Checks assumptions that the username and password properties are set and that the host is reachable.void
testCommitsApi()
This test demonstrates that while the expression defined 4 variables but we only supply 3 values, the expanded URI will not render a dangling "/" and generate a proper URI for the GitHub API.void
testCommitsApiWithSpecificCommit()
Looks at a specific commitvoid
testUserRepos()
-
Methods inherited from class com.damnhandy.uri.template.examples.AbstractExampleTest
createClient, executeRequest
-
-
-
-
Field Detail
-
BASE
public static final String BASE
- See Also:
- Constant Field Values
-
PATH_EXPRESSION
public static final String PATH_EXPRESSION
- See Also:
- Constant Field Values
-
PAGINATION
public static final String PAGINATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
setUp
public static void setUp() throws Exception
Checks assumptions that the username and password properties are set and that the host is reachable.- Throws:
Exception
-
testCommitsApi
public void testCommitsApi() throws Exception
This test demonstrates that while the expression defined 4 variables but we only supply 3 values, the expanded URI will not render a dangling "/" and generate a proper URI for the GitHub API.- Throws:
Exception
-
testCommitsApiWithSpecificCommit
public void testCommitsApiWithSpecificCommit() throws Exception
Looks at a specific commit- Throws:
Exception
-
createClient
protected com.ning.http.client.AsyncHttpClient createClient()
- Overrides:
createClient
in classAbstractExampleTest
-
-