Skip to content

Commit e96aa02

Browse files
committedNov 30, 2018
Merge branch '__rultor'
2 parents 566c364 + 88aec0d commit e96aa02

File tree

4 files changed

+41
-18
lines changed

4 files changed

+41
-18
lines changed
 

‎qulice-checkstyle/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
<packaging>jar</packaging>
4242
<name>qulice-checkstyle</name>
4343
<dependencies>
44+
<dependency>
45+
<groupId>org.cactoos</groupId>
46+
<artifactId>cactoos</artifactId>
47+
<version>0.38</version>
48+
</dependency>
4449
<dependency>
4550
<groupId>com.qulice</groupId>
4651
<artifactId>qulice-spi</artifactId>

‎qulice-checkstyle/src/main/resources/com/qulice/checkstyle/checks.xml

+5
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@
152152
<property name="fileExtensions" value="java"/>
153153
<property name="message" value="Use 'java.nio.charset.StandardCharsets' instead"/>
154154
</module>
155+
<module name="RegexpSingleline">
156+
<property name="format" value="com\.google\.common\.base\.Charsets"/>
157+
<property name="fileExtensions" value="java"/>
158+
<property name="message" value="Use 'java.nio.charset.StandardCharsets' instead"/>
159+
</module>
155160
<module name="RegexpSingleline">
156161
<property name="format" value="^(?! *(/\*\*|\*|/\*|//)).*[\.\-\+%/\*&lt;&gt;] *$"/>
157162
<property name="fileExtensions" value="java"/>

‎qulice-checkstyle/src/test/java/com/qulice/checkstyle/CheckstyleValidatorTest.java

+28-18
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@
3838
import java.util.Collection;
3939
import org.apache.commons.io.IOUtils;
4040
import org.apache.commons.lang3.StringUtils;
41+
import org.cactoos.list.ListOf;
4142
import org.hamcrest.Description;
4243
import org.hamcrest.MatcherAssert;
4344
import org.hamcrest.Matchers;
4445
import org.hamcrest.TypeSafeMatcher;
46+
import org.hamcrest.collection.IsIterableContainingInOrder;
4547
import org.junit.Ignore;
4648
import org.junit.Rule;
4749
import org.junit.Test;
@@ -221,24 +223,32 @@ public void reportsAllCharEncodingUsages() throws Exception {
221223
final String name = "RegexpSinglelineCheck";
222224
MatcherAssert.assertThat(
223225
results,
224-
Matchers.hasItems(
225-
new ViolationMatcher(
226-
message, file, "6", name
227-
),
228-
new ViolationMatcher(
229-
message, file, "7", name
230-
),
231-
new ViolationMatcher(
232-
message, file, "8", name
233-
),
234-
new ViolationMatcher(
235-
message, file, "20", name
236-
),
237-
new ViolationMatcher(
238-
message, file, "21", name
239-
),
240-
new ViolationMatcher(
241-
message, file, "22", name
226+
new IsIterableContainingInOrder<>(
227+
new ListOf<>(
228+
new ViolationMatcher(
229+
message, file, "6", name
230+
),
231+
new ViolationMatcher(
232+
message, file, "7", name
233+
),
234+
new ViolationMatcher(
235+
message, file, "8", name
236+
),
237+
new ViolationMatcher(
238+
message, file, "9", name
239+
),
240+
new ViolationMatcher(
241+
message, file, "22", name
242+
),
243+
new ViolationMatcher(
244+
message, file, "23", name
245+
),
246+
new ViolationMatcher(
247+
message, file, "24", name
248+
),
249+
new ViolationMatcher(
250+
message, file, "25", name
251+
)
242252
)
243253
)
244254
);

‎qulice-checkstyle/src/test/resources/com/qulice/checkstyle/DoNotUseCharEncoding.java

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44
package foo;
55

6+
import com.google.common.base.Charsets;
67
import org.apache.commons.codec.CharEncoding;
78
import org.apache.commons.lang.CharEncoding;
89
import org.apache.commons.lang3.CharEncoding;
@@ -17,8 +18,10 @@ public final class DoNotUseCharEncoding {
1718
*/
1819
public void act() {
1920
System.out.println(this + CharEncoding.UTF_8);
21+
System.out.println(this + Charsets.UTF_8);
2022
System.out.println(org.apache.commons.lang3.CharEncoding.UTF_8);
2123
System.out.println(org.apache.commons.lang.CharEncoding.ISO_8859_1);
2224
System.out.println(org.apache.commons.codec.CharEncoding.UTF_16);
25+
System.out.println(com.google.common.base.Charsets.UTF_8);
2326
}
2427
}

0 commit comments

Comments
 (0)
Please sign in to comment.