Skip to content

Commit

Permalink
OF-2628: Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Fishbowler committed Jul 21, 2023
1 parent f290e0c commit dc11312
Showing 1 changed file with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

import java.nio.charset.StandardCharsets;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.*;

/**
* Unit tests that verify the functionality as implemented in {@link XMLLightweightParser}
Expand Down Expand Up @@ -185,4 +184,32 @@ public void testOF2329SelfTerminatingWithNewline() throws Exception
assertNotNull( result );
assertEquals(1, result.length );
}

@Test
public void testHasIllegalCharacterReferencesFindsIllegalDecimalChars() throws Exception
{
final String input = "test A test";
assertFalse(XMLLightweightParser.hasIllegalCharacterReferences(input));
}

@Test
public void testHasIllegalCharacterReferencesFindsLegalDecimalChars() throws Exception
{
final String input = "test  test";
assertTrue(XMLLightweightParser.hasIllegalCharacterReferences(input));
}

@Test
public void testHasIllegalCharacterReferencesFindsIllegalHexChars() throws Exception
{
final String input = "test A test";
assertFalse(XMLLightweightParser.hasIllegalCharacterReferences(input));
}

@Test
public void testHasIllegalCharacterReferencesFindsLegalHexChars() throws Exception
{
final String input = "test  test";
assertTrue(XMLLightweightParser.hasIllegalCharacterReferences(input));
}
}

0 comments on commit dc11312

Please sign in to comment.