bson/src/main/org/bson/AbstractBsonReader.java
protected void verifyName(final String expectedName) {
        readBsonType();
        String actualName = readName();
        if (!actualName.equals(expectedName)) {
            throw new BsonSerializationException(format("Expected element name to be '%s', not '%s'.",
                                                        expectedName, actualName));
        }
    }
protected void verifyName(final String expectedName) {
        readBsonType();
        String actualName = readName();
        if (!actualName.equals(expectedName)) {
            throw new BsonSerializationException(format("Expected element name to be '%s', not '%s'.",
                                                        expectedName, actualName));
        }
    }
protected void verifyName ( final String expectedName ) { readBsonType ( ) ; String actualName = readName ( ) ; if ( ! actualName . equals ( expectedName ) ) { throw new BsonSerializationException ( format ( "Expected element name to be '%s', not '%s'." , expectedName , actualName ) ) ; } }
Verifies the name of the current element.

@param expectedName The expected name.
@throws BsonSerializationException when the name read is not the expected name
Verifies the name of the current element .