Skip to content

Commit f0d4887

Browse files
authored
Use StandardCharsets.UTF_8 in tests (#4002)
1 parent 876a62d commit f0d4887

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

processor/src/test/java/org/mapstruct/ap/testutil/runner/CompilingExtension.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.io.FileWriter;
1111
import java.io.IOException;
1212
import java.lang.reflect.Method;
13+
import java.nio.charset.StandardCharsets;
1314
import java.util.ArrayList;
1415
import java.util.Arrays;
1516
import java.util.Collection;
@@ -237,7 +238,7 @@ private void assertCheckstyleRules() throws Exception {
237238

238239
int errors = checker.process( findGeneratedFiles( new File( sourceOutputDir ) ) );
239240
if ( errors > 0 ) {
240-
String errorLog = errorStream.toString( "UTF-8" );
241+
String errorLog = errorStream.toString( StandardCharsets.UTF_8 );
241242
fail( "Expected checkstyle compliant output, but got errors:\n" + errorLog );
242243
}
243244
}

processor/src/test/java/org/mapstruct/ap/testutil/runner/GeneratedSource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
package org.mapstruct.ap.testutil.runner;
77

88
import java.io.File;
9-
import java.io.UnsupportedEncodingException;
109
import java.net.URL;
1110
import java.net.URLDecoder;
11+
import java.nio.charset.StandardCharsets;
1212
import java.util.ArrayList;
1313
import java.util.Arrays;
1414
import java.util.List;
@@ -119,7 +119,7 @@ public JavaFileAssert forJavaFile(String path) {
119119
return new JavaFileAssert( new File( sourceOutputDir.get() + "/" + path ) );
120120
}
121121

122-
private void handleFixtureComparison() throws UnsupportedEncodingException {
122+
private void handleFixtureComparison() {
123123
for ( Class<?> fixture : fixturesFor ) {
124124
String fixtureName = getMapperName( fixture );
125125
URL expectedFile = getExpectedResource( fixtureName );
@@ -131,7 +131,7 @@ private void handleFixtureComparison() throws UnsupportedEncodingException {
131131
) );
132132
}
133133
else {
134-
File expectedResource = new File( URLDecoder.decode( expectedFile.getFile(), "UTF-8" ) );
134+
File expectedResource = new File( URLDecoder.decode( expectedFile.getFile(), StandardCharsets.UTF_8 ) );
135135
forMapper( fixture ).hasSameMapperContent( expectedResource );
136136
}
137137
fixture.getPackage().getName();

0 commit comments

Comments
 (0)