Skip to content

Commit

Permalink
feat(#1663): fix all qulice suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Aug 4, 2023
1 parent e3c8a80 commit 6adb0e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/jcabi/github/RepositoryStatistics.java
Expand Up @@ -205,24 +205,24 @@ Object value(final JsonObject object) {
* @author Volodya Lombrozo (volodya.lombrozo@gmail.com)
* @since 1.8.0
*/
public static class Smart {
public static final class Smart {

/**
* Repository statistics.
*/
private final RepositoryStatistics stats;
private final transient RepositoryStatistics stats;

/**
* Public ctor.
* @param repo
* @param repo Repository.
*/
public Smart(final Repo repo) {
this(new RepositoryStatistics(repo));
}

/**
* Public ctor.
* @param statistics
* @param statistics Repository statistics.
*/
public Smart(final RepositoryStatistics statistics) {
this.stats = statistics;
Expand Down
20 changes: 16 additions & 4 deletions src/test/java/com/jcabi/github/RepositoryStatisticsTest.java
Expand Up @@ -50,7 +50,11 @@
* MkRepo should return different types like integer, double, long,
* etc. When it is implemented, we can replace strings with concrete
* types and remove that puzzle.
* @checkstyle StaticVariableNameCheck (1000 lines)
* @checkstyle MagicNumberCheck (1000 lines)
* @checkstyle LineLengthCheck (2 lines)
*/
@SuppressWarnings({"PMD.SuspiciousConstantFieldName", "PMD.VariableNamingConventions"})
public final class RepositoryStatisticsTest {

/**
Expand Down Expand Up @@ -131,8 +135,7 @@ public final class RepositoryStatisticsTest {
/**
* Updated value in JSON.
*/
private static String UPDATED_VALUE = "2011-01-26T19:14:43Z";

private static String UPDATED_VALUE = "2012-01-26T19:14:43Z";

/**
* Checks that RepositryStatistics can convert all values to a map.
Expand Down Expand Up @@ -191,10 +194,14 @@ public void retrievesBasicStatisticsFromRepo()
);
}

/**
* Checks that RepositryStatistics.Smart can retrieve all values.
* @throws IOException If some problem with I/O happened.
*/
@Test
public void retrievesSmartStatistics() throws IOException {
final RepositoryStatistics.Smart smart
= new RepositoryStatistics.Smart(this.repo());
final RepositoryStatistics.Smart smart =
new RepositoryStatistics.Smart(this.repo());
MatcherAssert.assertThat(
"Forks should be equal to 1",
smart.forks(),
Expand Down Expand Up @@ -241,6 +248,11 @@ public void retrievesSmartStatistics() throws IOException {
);
}

/**
* Creates mock repo.
* @return Repo
* @throws IOException If some problem with I/O happened.
*/
private Repo repo() throws IOException {
return new MkGithub()
.repos()
Expand Down

0 comments on commit 6adb0e9

Please sign in to comment.