diff --git a/src/main/java/org/kohsuke/github/GitHub.java b/src/main/java/org/kohsuke/github/GitHub.java index cfc3a8fd4..875cb314c 100644 --- a/src/main/java/org/kohsuke/github/GitHub.java +++ b/src/main/java/org/kohsuke/github/GitHub.java @@ -26,14 +26,11 @@ package org.kohsuke.github; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.introspect.VisibilityChecker.Std; import com.infradna.tool.bridge_method_injector.WithBridgeMethods; import org.apache.commons.codec.Charsets; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.kohsuke.github.example.dataobject.GHMetaExamples; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; @@ -817,23 +814,6 @@ public class GitHub { return retrieve().to("/meta", GHMeta.class); } - /** - * TEST-ONLY - *

- * Provides a list of GitHub's IP addresses. For testing and example purposes only. - * - * @see Get Meta - * - * @return an instance of {@link GHMeta} - * @throws IOException - * if the credentials supplied are invalid or if you're trying to access it as a GitHub App via the JWT - * authentication - */ - GHMetaExamples.GHMetaExample getMetaExample(Class clazz) - throws IOException { - return retrieve().to("/meta", clazz); - } - GHUser intern(GHUser user) throws IOException { if (user == null) return user; diff --git a/src/main/java/org/kohsuke/github/example/dataobject/GHMetaExamples.java b/src/main/java/org/kohsuke/github/example/dataobject/ReadOnlyObjects.java similarity index 99% rename from src/main/java/org/kohsuke/github/example/dataobject/GHMetaExamples.java rename to src/main/java/org/kohsuke/github/example/dataobject/ReadOnlyObjects.java index 7d36950e6..e56f40597 100644 --- a/src/main/java/org/kohsuke/github/example/dataobject/GHMetaExamples.java +++ b/src/main/java/org/kohsuke/github/example/dataobject/ReadOnlyObjects.java @@ -3,7 +3,6 @@ package org.kohsuke.github.example.dataobject; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; -import org.kohsuke.github.GitHub; import javax.annotation.Nonnull; import java.util.ArrayList; @@ -21,6 +20,7 @@ import java.util.List; *

  • Better: {@link GHMetaGettersUnmodifiable} is a good balance of clarity and brevity
  • *
  • Worse: {@link GHMetaPublic} exposes setters that are not needed, making it unclear that fields are actually * read-only
  • + * * * @author Liam Newman * @@ -28,7 +28,7 @@ import java.util.List; * @see Get Meta */ -public final class GHMetaExamples { +public final class ReadOnlyObjects { /** * All GHMeta data objects should expose these values. diff --git a/src/test/java/org/kohsuke/github/GitHubTest.java b/src/test/java/org/kohsuke/github/GitHubTest.java index ec73d8a90..81cfeba27 100644 --- a/src/test/java/org/kohsuke/github/GitHubTest.java +++ b/src/test/java/org/kohsuke/github/GitHubTest.java @@ -5,7 +5,7 @@ import java.util.*; import com.google.common.collect.Iterables; import org.junit.Test; -import org.kohsuke.github.example.dataobject.GHMetaExamples; +import org.kohsuke.github.example.dataobject.ReadOnlyObjects; import static org.hamcrest.CoreMatchers.*; @@ -87,12 +87,13 @@ public class GitHubTest extends AbstractGitHubWireMockTest { assertEquals(19, meta.getWeb().size()); // Also test examples here - Class[] examples = new Class[] { GHMetaExamples.GHMetaPublic.class, GHMetaExamples.GHMetaPackage.class, - GHMetaExamples.GHMetaGettersUnmodifiable.class, GHMetaExamples.GHMetaGettersFinal.class, - GHMetaExamples.GHMetaGettersFinalCreator.class, }; + Class[] examples = new Class[] { ReadOnlyObjects.GHMetaPublic.class, ReadOnlyObjects.GHMetaPackage.class, + ReadOnlyObjects.GHMetaGettersUnmodifiable.class, ReadOnlyObjects.GHMetaGettersFinal.class, + ReadOnlyObjects.GHMetaGettersFinalCreator.class, }; for (Class metaClass : examples) { - GHMetaExamples.GHMetaExample metaExample = gitHub.getMetaExample(metaClass); + ReadOnlyObjects.GHMetaExample metaExample = gitHub.retrieve().to("/meta", + (Class) metaClass); assertTrue(metaExample.isVerifiablePasswordAuthentication()); assertEquals(19, metaExample.getApi().size()); assertEquals(19, metaExample.getGit().size());