mirror of
https://github.com/theonedev/onedev.git
synced 2025-12-08 18:26:30 +00:00
chore: Fix unit test failure on Windows
This commit is contained in:
parent
fbe90e4213
commit
7b36bcfa15
@ -2,11 +2,13 @@ package io.onedev.server.util;
|
||||
|
||||
import com.google.common.io.Resources;
|
||||
import org.junit.Test;
|
||||
import org.mozilla.universalchardet.Constants;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ContentDetectorTest {
|
||||
|
||||
@ -14,7 +16,8 @@ public class ContentDetectorTest {
|
||||
public void detectCharset() {
|
||||
try (var is = Resources.getResource(ContentDetectorTest.class, "iso-8859-1.txt").openStream()) {
|
||||
var bytes = IOUtils.toByteArray(is);
|
||||
assertEquals(StandardCharsets.ISO_8859_1, ContentDetector.detectCharset(bytes));
|
||||
var charset = ContentDetector.detectCharset(bytes);
|
||||
assertTrue(charset.equals(StandardCharsets.ISO_8859_1) || charset.name().equals("windows-1252"));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user