Skip to content

Commit

Permalink
Set Windows EOL for test.
Browse files Browse the repository at this point in the history
  • Loading branch information
k3p7i3 committed Mar 20, 2024
1 parent 691ef10 commit d64bbdb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;

/**
* Test case for {@link CheckstyleValidator} class.
Expand Down Expand Up @@ -467,15 +469,15 @@ void prohibitWindowsEndsOfLine() throws Exception {
* @throws Exception If something wrong happens inside
*/
@Test
@EnabledOnOs(OS.WINDOWS)
void testWindowsEndsOfLineWithLinuxSources() throws Exception {
final String file = "WindowsEolLinux.java";
final Environment.Mock mock = new Environment.Mock();
final File license = this.createLicense(mock, "\r\n", "Hello.", "World.");
final Environment env = this.configureEnvironment(mock, license, file);
final Collection<Violation> results =
new CheckstyleValidator(env).validate(
env.files(file)
);
final Collection<Violation> results = new CheckstyleValidator(env).validate(
env.files(file)
);
final String message = "Line does not match expected header line of ' *'";
final String name = "HeaderCheck";
MatcherAssert.assertThat(
Expand Down Expand Up @@ -905,8 +907,7 @@ private File createLicense(final Environment env, final String eol, final String
throws IOException {
return this.rule.savePackageInfo(
new File(env.basedir(), CheckstyleValidatorTest.DIRECTORY)
).withLines(lines)
.withEol(eol).file();
).withLines(lines).withEol(eol).file();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* Hello.
*/
package foo;
/**
* Simple class.
* @since 1.0
*/
public class WindowsEol { }

/*
* Hello.
*/
package foo;
/**
* Simple class.
* @since 1.0
*/
public class WindowsEol { }

0 comments on commit d64bbdb

Please sign in to comment.