Skip to content

Commit 9a01f73

Browse files
committed
Add test for encoding
1 parent 8a9dda4 commit 9a01f73

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

qulice-maven-plugin/src/main/java/com/qulice/maven/DefaultMavenEnvironment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public void setAsser(final Collection<String> ass) {
298298
* @return Charset of the source files
299299
*/
300300
public Charset encoding() {
301-
String charset = this.iproperties.getProperty("project.build.sourceEncoding");
301+
String charset = this.iproject.getProperties().getProperty("project.build.sourceEncoding");
302302
if (charset == null) {
303303
charset = "UTF-8";
304304
}

qulice-maven-plugin/src/test/java/com/qulice/maven/DefaultMavenEnvironmentTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,17 @@ void producesEmptyExcludesWhenNoMatches() {
147147
Matchers.empty()
148148
);
149149
}
150+
151+
/**
152+
* Default source files encoding should be UFT-8.
153+
*/
154+
@Test
155+
void defaultEncodingIsUTF8() {
156+
final DefaultMavenEnvironment env = new DefaultMavenEnvironment();
157+
MatcherAssert.assertThat(
158+
"Default encoding should be UTF-8",
159+
env.encoding(),
160+
Matchers.is("UTF-8")
161+
);
162+
}
150163
}

qulice-maven-plugin/src/test/java/com/qulice/maven/MavenProjectMocker.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ public final class MavenProjectMocker {
5252
* In this basedir.
5353
* @param dir The directory
5454
* @return This object
55-
* @throws Exception If something wrong happens inside
5655
*/
57-
public MavenProjectMocker inBasedir(final File dir) throws Exception {
56+
public MavenProjectMocker inBasedir(final File dir) {
5857
Mockito.doReturn(dir).when(this.project).getBasedir();
5958
final Build build = Mockito.mock(Build.class);
6059
Mockito.doReturn(build).when(this.project).getBuild();

0 commit comments

Comments
 (0)