From a587359e8c6c6153f62e4e085dc26df9dc6b4feb Mon Sep 17 00:00:00 2001 From: Yuyan Z <64955334+yuyan-z@users.noreply.github.com> Date: Tue, 21 Nov 2023 22:04:43 +0100 Subject: [PATCH] Update ASCIICharacterCheckerTest.java --- .../integrity/ASCIICharacterCheckerTest.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/jabref/logic/integrity/ASCIICharacterCheckerTest.java b/src/test/java/org/jabref/logic/integrity/ASCIICharacterCheckerTest.java index 09efadebe2d9..44a0d7a4d683 100644 --- a/src/test/java/org/jabref/logic/integrity/ASCIICharacterCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/ASCIICharacterCheckerTest.java @@ -18,19 +18,22 @@ public class ASCIICharacterCheckerTest { @Test void fieldAcceptsAsciiCharacters() { entry.setField(StandardField.TITLE, "Only ascii characters!'@12"); - assertEquals(Collections.emptyList(), checker.check(entry)); + assertEquals(Collections.emptyList(), + new FieldChecker(StandardField.TITLE, checker).check(entry)); } @Test void fieldDoesNotAcceptUmlauts() { entry.setField(StandardField.MONTH, "Umlauts are nöt ällowed"); - assertEquals(List.of(new IntegrityMessage("Non-ASCII encoded character found", entry, StandardField.MONTH)), checker.check(entry)); + assertEquals(List.of(new IntegrityMessage("Non-ASCII encoded character found", entry, StandardField.MONTH)), + new FieldChecker(StandardField.MONTH, checker).check(entry)); } @Test void fieldDoesNotAcceptUnicode() { entry.setField(StandardField.AUTHOR, "Some unicode ⊕"); - assertEquals(List.of(new IntegrityMessage("Non-ASCII encoded character found", entry, StandardField.AUTHOR)), checker.check(entry)); + assertEquals(List.of(new IntegrityMessage("Non-ASCII encoded character found", entry, StandardField.AUTHOR)), + new FieldChecker(StandardField.AUTHOR, checker).check(entry)); } @Test @@ -40,13 +43,15 @@ void fieldAcceptsOnlyAsciiCharacters() { field += Character.toString(i); } entry.setField(StandardField.TITLE, field); - assertEquals(Collections.emptyList(), checker.check(entry)); + assertEquals(Collections.emptyList(), + new FieldChecker(StandardField.TITLE, checker).check(entry)); } @Test void fieldDoesNotAcceptNonAsciiCharacters() { String field = Character.toString(31) + Character.toString(128); entry.setField(StandardField.TITLE, field); - assertEquals(List.of(new IntegrityMessage("Non-ASCII encoded character found", entry, StandardField.TITLE)), checker.check(entry)); + assertEquals(List.of(new IntegrityMessage("Non-ASCII encoded character found", entry, StandardField.TITLE)), + new FieldChecker(StandardField.TITLE, checker).check(entry)); } }