Fixed up tests

This commit is contained in:
Kohsuke Kawaguchi
2016-08-05 20:44:45 -07:00
parent 70f0f5714a
commit 6a356c82a5
2 changed files with 6 additions and 10 deletions

View File

@@ -850,10 +850,7 @@ public class GHRepository extends GHObject {
/**
* Gets the basic license details for the repository.
* <p>
* This is a preview item and requires you to use {@link org.kohsuke.github.extras.PreviewHttpConnector}
* <p>
* Warning: Only returns the basic license details. Use {@link GitHub#getLicense(String)}
* to get the full license information (hint: pass it {@link GHLicenseBase#getKey()}).
* This is a preview item and subject to change.
*
* @throws IOException as usual but also if you don't use the preview connector
*/
@@ -868,11 +865,12 @@ public class GHRepository extends GHObject {
/**
* Retrieves the contents of the repository's license file - makes an additional API call
* <p>
* This is a preview item and requires you to use {@link org.kohsuke.github.extras.PreviewHttpConnector}
* This is a preview item and subject to change.
*
* @return details regarding the license contents
* @throws IOException as usual but also if you don't use the preview connector
*/
@Preview @Deprecated
public GHContent getLicenseContent() throws IOException {
return root.retrieve().to(getApiTailUrl("license"), GHContent.class).wrap(this);
}

View File

@@ -28,11 +28,9 @@ import org.apache.commons.io.IOUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.kohsuke.github.extras.PreviewHttpConnector;
import java.io.IOException;
import java.net.URL;
import java.util.List;
/**
* @author Duncan Dickinson
@@ -54,8 +52,8 @@ public class GHLicenseTest extends Assert {
*/
@Test
public void listLicenses() throws IOException {
List<GHLicense> licenses = gitHub.listLicenses();
assertTrue(licenses.size() > 0);
Iterable<GHLicense> licenses = gitHub.listLicenses();
assertTrue(licenses.iterator().hasNext());
}
/**
@@ -66,7 +64,7 @@ public class GHLicenseTest extends Assert {
*/
@Test
public void listLicensesCheckIndividualLicense() throws IOException {
List<GHLicense> licenses = gitHub.listLicenses();
PagedIterable<GHLicense> licenses = gitHub.listLicenses();
for (GHLicense lic : licenses) {
if (lic.getKey().equals("mit")) {
assertTrue(lic.getUrl().equals(new URL("https://api.github.com/licenses/mit")));