public void testAllowUndefinedConstants() {
    ConstantDefinitions definitions = EasyMock.createMock(ConstantDefinitions.class);
    expect(definitions.getConstantDefinition("Foo")).andStubReturn(null);

    SourceCodeLocation loc = createMock(SourceCodeLocation.class);
    CssConstantReferenceNode refNode = createMock(CssConstantReferenceNode.class);
    expect(refNode.getValue()).andStubReturn("Foo");
    expect(refNode.getSourceCodeLocation()).andStubReturn(loc);

    // This should not cause an error to be reported.
    ErrorManager errorManager = createMock(ErrorManager.class);
    replay(definitions, refNode, errorManager);
    ReplaceConstantReferences allowingPass =
        new ReplaceConstantReferences(
            createMock(CssTree.class),
            definitions,
            true /* removeDefs */,
            errorManager,
            true /* allowUndefinedConstants */);
    allowingPass.replaceConstantReference(refNode);
    verify(definitions, refNode, errorManager);
  }