package com.fasterxml.jackson.core.json;

import com.fasterxml.jackson.core.*;

public class TestParserSymbols
    extends com.fasterxml.jackson.core.BaseTest
{
    // For [Issue#148]
    public void testSymbolsWithNullBytes() throws Exception {
        _testSymbolsWithNull(true);
    }

    // For [Issue#148]
    public void testSymbolsWithNullChars() throws Exception {
        _testSymbolsWithNull(false);
    }
    
    private void _testSymbolsWithNull(boolean useBytes) throws Exception
    {
        final JsonFactory f = new JsonFactory();
        final String INPUT = "{\"\\u0000abc\" : 1, \"abc\" : 2}";
        JsonParser parser = useBytes ? f.createParser(INPUT.getBytes("UTF-8"))
                : f.createParser(INPUT);

        assertToken(JsonToken.START_OBJECT, parser.nextToken());

        assertToken(JsonToken.FIELD_NAME, parser.nextToken());
        assertEquals("\u0000abc", parser.getCurrentName());
        assertToken(JsonToken.VALUE_NUMBER_INT, parser.nextToken());
        assertEquals(1, parser.getIntValue());

        assertToken(JsonToken.FIELD_NAME, parser.nextToken());
        assertEquals("abc", parser.getCurrentName());
        assertToken(JsonToken.VALUE_NUMBER_INT, parser.nextToken());
        assertEquals(2, parser.getIntValue());
        
        assertToken(JsonToken.END_OBJECT, parser.nextToken());
        parser.close();
    }
}

@@ -871,59 +871,192 @@
     
-assertEquals(%22%5Cu0000abc%22, parser.getCurrentName());
+String currName = parser.getCurrentName();%0A        if (!%22%5Cu0000abc%22.equals(currName)) %7B%0A            fail(%22Expected %5C%5C0abc (4 bytes), '%22+currName+%22' (%22+currName.length()+%22)%22);%0A        %7D
 %0A   
@@ -1244,53 +1244,178 @@
     
-assertEquals(%22abc%22, parser.getCurrentName());
+currName = parser.getCurrentName();%0A        if (!%22abc%22.equals(currName)) %7B%0A            fail(%22Expected 'abc' (3 bytes), '%22+currName+%22' (%22+currName.length()+%22)%22);%0A        %7D
 %0A   

improve a test