@Test
public void test() throws IOException {
File tempFile = File.createTempFile("metadata", "");
ItemsMetadata itemsMetadata = new ItemsMetadata(tempFile);
for (int i = 0; i < 10; i++) {
Map<String, String> md1 = itemsMetadata.loadMetadata("o" + i);
md1.put("differentAtt", "value" + i);
md1.put("sameAtt", "value");
}
itemsMetadata.save();
itemsMetadata = new ItemsMetadata(tempFile);
assertEquals(10, itemsMetadata.findByAttValue("sameAtt", "value")
.size());
assertEquals(1, itemsMetadata.findByAttValue("differentAtt", "value1")
.size());
assertEquals(10, itemsMetadata
.findByAttRegex("differentAtt", "value.*").size());
}