diff --git a/.rultor.yml b/.rultor.yml index 0de8d7a60..cbd0f396d 100644 --- a/.rultor.yml +++ b/.rultor.yml @@ -1,5 +1,5 @@ docker: - image: yegor256/rultor-image:1.13.0 + image: yegor256/rultor-image:1.23.1 assets: settings.xml: yegor256/home#assets/jcabi/settings.xml secring.gpg: yegor256/home#assets/secring.gpg diff --git a/src/main/java/com/jcabi/github/Comment.java b/src/main/java/com/jcabi/github/Comment.java index 9e492078f..5d7b51106 100644 --- a/src/main/java/com/jcabi/github/Comment.java +++ b/src/main/java/com/jcabi/github/Comment.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.ParseException; import java.util.Collection; @@ -79,7 +81,7 @@ public interface Comment * Number. * @return Comment number */ - int number(); + long number(); /** * Delete the comment. @@ -161,7 +163,11 @@ public void body(final String text) throws IOException { * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** * When this comment was created. @@ -196,7 +202,7 @@ public Issue issue() { return this.comment.issue(); } @Override - public int number() { + public long number() { return this.comment.number(); } @Override diff --git a/src/main/java/com/jcabi/github/Commit.java b/src/main/java/com/jcabi/github/Commit.java index 4221c22d0..2837f8fb3 100644 --- a/src/main/java/com/jcabi/github/Commit.java +++ b/src/main/java/com/jcabi/github/Commit.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import javax.json.JsonObject; import lombok.EqualsAndHashCode; @@ -106,7 +108,11 @@ public String message() throws IOException { * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } @Override public Repo repo() { diff --git a/src/main/java/com/jcabi/github/Content.java b/src/main/java/com/jcabi/github/Content.java index 5e32a2c66..f69ce88b9 100644 --- a/src/main/java/com/jcabi/github/Content.java +++ b/src/main/java/com/jcabi/github/Content.java @@ -33,6 +33,8 @@ import com.jcabi.aspects.Loggable; import java.io.IOException; import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import javax.json.JsonObject; import javax.xml.bind.DatatypeConverter; @@ -134,7 +136,11 @@ public String sha() throws IOException { * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** * Get its HTML URL. @@ -142,7 +148,11 @@ public URL url() throws IOException { * @throws IOException If there is any I/O problem */ public URL htmlUrl() throws IOException { - return new URL(this.jsn.text("html_url")); + try { + return new URI(this.jsn.text("html_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** * Get its GIT URL. @@ -150,7 +160,11 @@ public URL htmlUrl() throws IOException { * @throws IOException If there is any I/O problem */ public URL gitUrl() throws IOException { - return new URL(this.jsn.text("git_url")); + try { + return new URI(this.jsn.text("git_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** * Get its encoded content. diff --git a/src/main/java/com/jcabi/github/DeployKey.java b/src/main/java/com/jcabi/github/DeployKey.java index 7bf69b4e7..078753378 100644 --- a/src/main/java/com/jcabi/github/DeployKey.java +++ b/src/main/java/com/jcabi/github/DeployKey.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import javax.json.Json; import javax.json.JsonObject; @@ -118,7 +120,11 @@ public void key(final String value) throws IOException { * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** diff --git a/src/main/java/com/jcabi/github/Event.java b/src/main/java/com/jcabi/github/Event.java index f031f9ed5..bf936cbc3 100644 --- a/src/main/java/com/jcabi/github/Event.java +++ b/src/main/java/com/jcabi/github/Event.java @@ -33,6 +33,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.ParseException; import java.util.Date; @@ -223,7 +225,11 @@ public String type() throws IOException { * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** * When this issue was created. diff --git a/src/main/java/com/jcabi/github/Fork.java b/src/main/java/com/jcabi/github/Fork.java index dd5d85f93..bb718bf61 100644 --- a/src/main/java/com/jcabi/github/Fork.java +++ b/src/main/java/com/jcabi/github/Fork.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import javax.json.JsonObject; import lombok.EqualsAndHashCode; @@ -103,7 +105,11 @@ public String organization() throws IOException { * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** @@ -130,7 +136,11 @@ public String description() throws IOException { * @throws IOException If there is any I/O problem */ public URL htmlUrl() throws IOException { - return new URL(this.jsn.text("html_url")); + try { + return new URI(this.jsn.text("html_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** @@ -139,7 +149,11 @@ public URL htmlUrl() throws IOException { * @throws IOException If there is any I/O problem */ public URL cloneUrl() throws IOException { - return new URL(this.jsn.text("clone_url")); + try { + return new URI(this.jsn.text("clone_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** @@ -166,7 +180,11 @@ public String sshUrl() throws IOException { * @throws IOException If there is any I/O problem */ public URL svnUrl() throws IOException { - return new URL(this.jsn.text("svn_url")); + try { + return new URI(this.jsn.text("svn_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** @@ -184,7 +202,11 @@ public String mirrorUrl() throws IOException { * @throws IOException If there is any I/O problem */ public URL homeUrl() throws IOException { - return new URL(this.jsn.text("homepage")); + try { + return new URI(this.jsn.text("homepage")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** diff --git a/src/main/java/com/jcabi/github/GistComment.java b/src/main/java/com/jcabi/github/GistComment.java index 637f3e6e1..2c078c0bf 100644 --- a/src/main/java/com/jcabi/github/GistComment.java +++ b/src/main/java/com/jcabi/github/GistComment.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.ParseException; import java.util.Date; @@ -149,7 +151,11 @@ public void body(final String text) throws IOException { * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** diff --git a/src/main/java/com/jcabi/github/Issue.java b/src/main/java/com/jcabi/github/Issue.java index 0e8e1a764..8079501b5 100644 --- a/src/main/java/com/jcabi/github/Issue.java +++ b/src/main/java/com/jcabi/github/Issue.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.ParseException; import java.util.ArrayList; @@ -320,7 +322,11 @@ public void assign(final String login) throws IOException { * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** * Get its HTML URL. @@ -328,7 +334,11 @@ public URL url() throws IOException { * @throws IOException If there is any I/O problem */ public URL htmlUrl() throws IOException { - return new URL(this.jsn.text("html_url")); + try { + return new URI(this.jsn.text("html_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** * When this issue was created. diff --git a/src/main/java/com/jcabi/github/Milestone.java b/src/main/java/com/jcabi/github/Milestone.java index a22479a07..df409f207 100644 --- a/src/main/java/com/jcabi/github/Milestone.java +++ b/src/main/java/com/jcabi/github/Milestone.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.ParseException; import java.util.Date; @@ -245,7 +247,11 @@ public void description( * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** diff --git a/src/main/java/com/jcabi/github/Organization.java b/src/main/java/com/jcabi/github/Organization.java index 85b1360c0..d0a472f61 100644 --- a/src/main/java/com/jcabi/github/Organization.java +++ b/src/main/java/com/jcabi/github/Organization.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.ParseException; import java.util.Date; @@ -245,7 +247,11 @@ public String blog() throws IOException { * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** @@ -254,7 +260,11 @@ public URL url() throws IOException { * @throws IOException If there is any I/O problem */ public URL htmlUrl() throws IOException { - return new URL(this.jsn.text("html_url")); + try { + return new URI(this.jsn.text("html_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** @@ -263,7 +273,11 @@ public URL htmlUrl() throws IOException { * @throws IOException If there is any I/O problem */ public URL avatarUrl() throws IOException { - return new URL(this.jsn.text("avatar_url")); + try { + return new URI(this.jsn.text("avatar_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** diff --git a/src/main/java/com/jcabi/github/PublicKey.java b/src/main/java/com/jcabi/github/PublicKey.java index 2390836c6..1732ecfa1 100644 --- a/src/main/java/com/jcabi/github/PublicKey.java +++ b/src/main/java/com/jcabi/github/PublicKey.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import javax.json.Json; import javax.json.JsonObject; @@ -132,7 +134,11 @@ public void key( * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** diff --git a/src/main/java/com/jcabi/github/Pull.java b/src/main/java/com/jcabi/github/Pull.java index 8c1a58790..ad48871aa 100644 --- a/src/main/java/com/jcabi/github/Pull.java +++ b/src/main/java/com/jcabi/github/Pull.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.ParseException; import java.util.Date; @@ -242,7 +244,11 @@ public void body( * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** @@ -251,7 +257,11 @@ public URL url() throws IOException { * @throws IOException If there is any I/O problem */ public URL htmlUrl() throws IOException { - return new URL(this.jsn.text("html_url")); + try { + return new URI(this.jsn.text("html_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** diff --git a/src/main/java/com/jcabi/github/Release.java b/src/main/java/com/jcabi/github/Release.java index 20dc89771..55b0718c8 100644 --- a/src/main/java/com/jcabi/github/Release.java +++ b/src/main/java/com/jcabi/github/Release.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.ParseException; import java.util.Date; @@ -141,7 +143,11 @@ public ReleaseAssets assets() { * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** @@ -150,7 +156,11 @@ public URL url() throws IOException { * @throws IOException If there is any I/O problem */ public URL htmlUrl() throws IOException { - return new URL(this.jsn.text("html_url")); + try { + return new URI(this.jsn.text("html_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** @@ -159,7 +169,11 @@ public URL htmlUrl() throws IOException { * @throws IOException If there is any I/O problem */ public URL assetsUrl() throws IOException { - return new URL(this.jsn.text("assets_url")); + try { + return new URI(this.jsn.text("assets_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** @@ -168,7 +182,11 @@ public URL assetsUrl() throws IOException { * @throws IOException If there is any I/O problem */ public URL uploadUrl() throws IOException { - return new URL(this.jsn.text("upload_url")); + try { + return new URI(this.jsn.text("upload_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** diff --git a/src/main/java/com/jcabi/github/ReleaseAsset.java b/src/main/java/com/jcabi/github/ReleaseAsset.java index 6fb6bae34..b14edba34 100644 --- a/src/main/java/com/jcabi/github/ReleaseAsset.java +++ b/src/main/java/com/jcabi/github/ReleaseAsset.java @@ -33,6 +33,8 @@ import com.jcabi.aspects.Loggable; import java.io.IOException; import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.ParseException; import java.util.Date; @@ -113,7 +115,11 @@ public Smart( * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** diff --git a/src/main/java/com/jcabi/github/RepoCommit.java b/src/main/java/com/jcabi/github/RepoCommit.java index a9385e4ff..f747d83a5 100644 --- a/src/main/java/com/jcabi/github/RepoCommit.java +++ b/src/main/java/com/jcabi/github/RepoCommit.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import javax.json.JsonObject; import lombok.EqualsAndHashCode; @@ -111,7 +113,11 @@ public String message() throws IOException { * @throws IOException If there is any I/O problem */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** * Returns the login of the author. diff --git a/src/main/java/com/jcabi/github/RtComment.java b/src/main/java/com/jcabi/github/RtComment.java index 2ae8f64c4..f4e5d8dbb 100644 --- a/src/main/java/com/jcabi/github/RtComment.java +++ b/src/main/java/com/jcabi/github/RtComment.java @@ -71,7 +71,7 @@ final class RtComment implements Comment { /** * Comment number. */ - private final transient int num; + private final transient long num; /** * Public ctor. @@ -79,7 +79,7 @@ final class RtComment implements Comment { * @param issue Owner of this comment * @param number Number of the get */ - RtComment(final Request req, final Issue issue, final int number) { + RtComment(final Request req, final Issue issue, final long number) { final Coordinates coords = issue.repo().coordinates(); this.request = req.uri() .path("/repos") @@ -87,7 +87,7 @@ final class RtComment implements Comment { .path(coords.repo()) .path("/issues") .path("/comments") - .path(Integer.toString(number)) + .path(Long.toString(number)) .back(); this.owner = issue; this.num = number; @@ -104,7 +104,7 @@ public Issue issue() { } @Override - public int number() { + public long number() { return this.num; } @@ -129,7 +129,7 @@ public void patch(final JsonObject json) throws IOException { public int compareTo( final Comment comment ) { - return this.number() - comment.number(); + return Long.compare(this.number(), comment.number()); } @Override diff --git a/src/main/java/com/jcabi/github/User.java b/src/main/java/com/jcabi/github/User.java index 48081d00d..82ffa9031 100644 --- a/src/main/java/com/jcabi/github/User.java +++ b/src/main/java/com/jcabi/github/User.java @@ -32,6 +32,8 @@ import com.jcabi.aspects.Immutable; import com.jcabi.aspects.Loggable; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.ParseException; import java.util.Date; @@ -160,7 +162,11 @@ public int id() throws IOException { * @throws IOException If it fails */ public URL avatarUrl() throws IOException { - return new URL(this.jsn.text("avatar_url")); + try { + return new URI(this.jsn.text("avatar_url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** @@ -169,7 +175,11 @@ public URL avatarUrl() throws IOException { * @throws IOException If it fails */ public URL url() throws IOException { - return new URL(this.jsn.text("url")); + try { + return new URI(this.jsn.text("url")).toURL(); + } catch (final URISyntaxException ex) { + throw new IllegalArgumentException(ex); + } } /** diff --git a/src/main/java/com/jcabi/github/mock/MkComment.java b/src/main/java/com/jcabi/github/mock/MkComment.java index f6593be22..41ad37078 100644 --- a/src/main/java/com/jcabi/github/mock/MkComment.java +++ b/src/main/java/com/jcabi/github/mock/MkComment.java @@ -109,7 +109,7 @@ public Issue issue() { } @Override - public int number() { + public long number() { return this.num; } @@ -124,7 +124,7 @@ public void remove() throws IOException { public int compareTo( final Comment comment ) { - return this.number() - comment.number(); + return Long.compare(this.number(), comment.number()); } @Override diff --git a/src/main/java/com/jcabi/github/safe/SfComment.java b/src/main/java/com/jcabi/github/safe/SfComment.java index f2d640c26..11537adc0 100644 --- a/src/main/java/com/jcabi/github/safe/SfComment.java +++ b/src/main/java/com/jcabi/github/safe/SfComment.java @@ -77,7 +77,7 @@ public Issue issue() { } @Override - public int number() { + public long number() { return this.origin.number(); } diff --git a/src/test/java/com/jcabi/github/ContentTest.java b/src/test/java/com/jcabi/github/ContentTest.java index d8b9b4b89..12fb2d5dc 100644 --- a/src/test/java/com/jcabi/github/ContentTest.java +++ b/src/test/java/com/jcabi/github/ContentTest.java @@ -29,7 +29,7 @@ */ package com.jcabi.github; -import java.net.URL; +import java.net.URI; import java.nio.charset.StandardCharsets; import javax.json.Json; import org.hamcrest.MatcherAssert; @@ -153,7 +153,7 @@ public final void fetchesUrl() throws Exception { ).when(content).json(); MatcherAssert.assertThat( new Content.Smart(content).url(), - Matchers.is(new URL(prop)) + Matchers.is(new URI(prop).toURL()) ); } @@ -173,7 +173,7 @@ public final void fetchesGitUrl() throws Exception { ).when(content).json(); MatcherAssert.assertThat( new Content.Smart(content).gitUrl(), - Matchers.is(new URL(prop)) + Matchers.is(new URI(prop).toURL()) ); } @@ -193,7 +193,7 @@ public final void fetchesHtmlUrl() throws Exception { ).when(content).json(); MatcherAssert.assertThat( new Content.Smart(content).htmlUrl(), - Matchers.is(new URL(prop)) + Matchers.is(new URI(prop).toURL()) ); } diff --git a/src/test/java/com/jcabi/github/ReleaseAssetTest.java b/src/test/java/com/jcabi/github/ReleaseAssetTest.java index bba122865..3f40f77ce 100644 --- a/src/test/java/com/jcabi/github/ReleaseAssetTest.java +++ b/src/test/java/com/jcabi/github/ReleaseAssetTest.java @@ -29,7 +29,7 @@ */ package com.jcabi.github; -import java.net.URL; +import java.net.URI; import javax.json.Json; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -61,7 +61,7 @@ public final void fetchesUrl() throws Exception { ).when(releaseAsset).json(); MatcherAssert.assertThat( new ReleaseAsset.Smart(releaseAsset).url(), - Matchers.is(new URL(prop)) + Matchers.is(new URI(prop).toURL()) ); } diff --git a/src/test/java/com/jcabi/github/RepoCommitTest.java b/src/test/java/com/jcabi/github/RepoCommitTest.java index 5c87f4aa3..198d2a670 100644 --- a/src/test/java/com/jcabi/github/RepoCommitTest.java +++ b/src/test/java/com/jcabi/github/RepoCommitTest.java @@ -30,7 +30,7 @@ package com.jcabi.github; import java.io.IOException; -import java.net.URL; +import java.net.URI; import javax.json.Json; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -61,7 +61,7 @@ public final void fetchesUrl() throws Exception { ).when(commit).json(); MatcherAssert.assertThat( new RepoCommit.Smart(commit).url(), - Matchers.is(new URL(prop)) + Matchers.is(new URI(prop).toURL()) ); } diff --git a/src/test/java/com/jcabi/github/RtCommentTest.java b/src/test/java/com/jcabi/github/RtCommentTest.java index d7214a55e..0cf078450 100644 --- a/src/test/java/com/jcabi/github/RtCommentTest.java +++ b/src/test/java/com/jcabi/github/RtCommentTest.java @@ -102,7 +102,7 @@ public void returnsItsIssue() throws Exception { public void returnsItsNumber() throws Exception { final Repo repo = new MkGithub().randomRepo(); final Issue issue = repo.issues().create("testing2", "issue2"); - final int num = 10; + final long num = 10L; final RtComment comment = new RtComment(new FakeRequest(), issue, num); MatcherAssert.assertThat(comment.number(), Matchers.is(num)); } diff --git a/src/test/java/com/jcabi/github/mock/MkCommentTest.java b/src/test/java/com/jcabi/github/mock/MkCommentTest.java index dc827e33a..52b6a3928 100644 --- a/src/test/java/com/jcabi/github/mock/MkCommentTest.java +++ b/src/test/java/com/jcabi/github/mock/MkCommentTest.java @@ -33,7 +33,7 @@ import com.jcabi.github.Comment; import com.jcabi.github.Coordinates; import com.jcabi.github.Repos; -import java.net.URL; +import java.net.URI; import java.util.Date; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -104,7 +104,7 @@ public void dataStoredProperly() throws Exception { final long after = MkCommentTest.now(); MatcherAssert.assertThat( comment.number(), - Matchers.greaterThan(0) + Matchers.greaterThan(0L) ); final Comment.Smart smart = new Comment.Smart(comment); MatcherAssert.assertThat( @@ -122,10 +122,10 @@ public void dataStoredProperly() throws Exception { MatcherAssert.assertThat( smart.url(), Matchers.equalTo( - new URL( + new URI( // @checkstyle LineLength (1 line) "https://api.jcabi-github.invalid/repos/jeff/blueharvest/issues/comments/1" - ) + ).toURL() ) ); MatcherAssert.assertThat(