Skip to content

Commit 5f92ec6

Browse files
committedApr 30, 2019
#1009:Replaces IOUtils on Cactoos alternative TextOf.
1 parent cd1e2c9 commit 5f92ec6

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed
 

‎pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@
134134
<artifactId>commons-lang3</artifactId>
135135
<version>3.7</version>
136136
</dependency>
137+
<dependency>
138+
<groupId>org.cactoos</groupId>
139+
<artifactId>cactoos</artifactId>
140+
<version>0.41</version>
141+
</dependency>
137142
<dependency>
138143
<groupId>org.junit.jupiter</groupId>
139144
<artifactId>junit-jupiter-api</artifactId>

‎qulice-pmd/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@
8383
<scope>runtime</scope>
8484
</dependency>
8585
<dependency>
86-
<groupId>commons-io</groupId>
87-
<artifactId>commons-io</artifactId>
86+
<groupId>org.cactoos</groupId>
87+
<artifactId>cactoos</artifactId>
8888
</dependency>
8989
<dependency>
9090
<groupId>org.junit.jupiter</groupId>

‎qulice-pmd/src/test/java/com/qulice/pmd/PmdAssert.java

+4-8
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@
3232
import com.qulice.spi.Environment;
3333
import com.qulice.spi.Violation;
3434
import java.io.File;
35-
import java.nio.charset.StandardCharsets;
3635
import java.util.Collection;
3736
import java.util.Collections;
38-
import org.apache.commons.io.IOUtils;
37+
import org.cactoos.text.TextOf;
3938
import org.hamcrest.Matcher;
4039
import org.hamcrest.MatcherAssert;
4140

@@ -75,18 +74,15 @@ final class PmdAssert {
7574
/**
7675
* Validated given file against PMD.
7776
* @throws Exception In case of error.
78-
* @todo #966:5min Add Cactoos dependency to qulice-pmd and replace IOUtils
79-
* usage with Cactoos alternatives `TextOf` and `ResourceOf`
8077
*/
8178
public void validate() throws Exception {
8279
final Environment.Mock mock = new Environment.Mock();
8380
final String name = String.format("src/main/java/foo/%s", this.file);
8481
final Environment env = mock.withFile(
8582
name,
86-
IOUtils.toString(
87-
this.getClass().getResourceAsStream(this.file),
88-
StandardCharsets.UTF_8
89-
)
83+
new TextOf(
84+
this.getClass().getResourceAsStream(this.file)
85+
).asString()
9086
);
9187
final Collection<Violation> violations = new PmdValidator(env).validate(
9288
Collections.singletonList(new File(env.basedir(), name))

0 commit comments

Comments
 (0)
Please sign in to comment.