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
UriTemplatefor 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 StringBASEstatic StringPAGINATIONstatic StringPATH_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.AsyncHttpClientcreateClient()static voidsetUp()Checks assumptions that the username and password properties are set and that the host is reachable.voidtestCommitsApi()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.voidtestCommitsApiWithSpecificCommit()Looks at a specific commitvoidtestUserRepos()-
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 ExceptionChecks assumptions that the username and password properties are set and that the host is reachable.- Throws:
Exception
-
testCommitsApi
public void testCommitsApi() throws ExceptionThis 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 ExceptionLooks at a specific commit- Throws:
Exception
-
createClient
protected com.ning.http.client.AsyncHttpClient createClient()
- Overrides:
createClientin classAbstractExampleTest
-
-