int offset2 = builder.getOffset();
builder.addAttributes(attributes);
int offset3 = builder.getOffset();
AttributesContainer container = builder.buildContainer();
AttributesWindow window = container.createWindow();
int index;
// First search for attributes in the first set of attributes.
window.move(offset1, offset2 - offset1);
index = window.getIndex("", "abc");
assertEquals("Index incorrect for attribute", 0, index);
index = window.getIndex("abc");
assertEquals("Index incorrect for attribute", 0, index);
index = window.getIndex("", "xyz");
assertEquals("Index incorrect for attribute", 1, index);
index = window.getIndex("xyz");
assertEquals("Index incorrect for attribute", 1, index);
index = window.getIndex("", "qrs");
assertEquals("Index incorrect for missing attribute", -1, index);
index = window.getIndex("qrs");
assertEquals("Index incorrect for missing attribute", -1, index);
// Now move the window and try again.
window.move(offset2, offset3 - offset2);
index = window.getIndex("", "abc");
assertEquals("Index incorrect for attribute", 0, index);
index = window.getIndex("abc");
assertEquals("Index incorrect for attribute", 0, index);
index = window.getIndex("", "xyz");
assertEquals("Index incorrect for attribute", 1, index);
index = window.getIndex("xyz");
assertEquals("Index incorrect for attribute", 1, index);
index = window.getIndex("", "qrs");
assertEquals("Index incorrect for missing attribute", -1, index);
index = window.getIndex("qrs");
assertEquals("Index incorrect for missing attribute", -1, index);
}