* @throws SQLException
* @throws IOException
*/
@Test
public void testLabels() throws ClassNotFoundException, SQLException, IOException {
DB db = new DB(DB_PATH);
long labelID = db.createLabel("lucas");
assertEquals("lucas", db.getLabelName(labelID));
db.addLabelToDocument(3312L, labelID);
List<Long> list = db.getDocumentsFromLabel(labelID);
assertEquals(1, list.size());
assertEquals(3312L, list.get(0).longValue());
db.deleteLabel(labelID);
list = db.getDocumentsFromLabel(labelID);
assertEquals(0, list.size());
labelID = db.createLabel("luisa");
db.addLabelToDocument(3312L, labelID);
list = db.getDocumentsFromLabel(labelID);
assertEquals(1, list.size());
assertEquals(3312L, list.get(0).longValue());
list = db.getLabelsFromDocument(3312L);
assertEquals(1, list.size());
assertEquals(labelID, list.get(0).longValue());
db.removeLabelFromDocument(3312L, labelID);
list = db.getLabelsFromDocument(3312L);
assertEquals(0, list.size());
db.close();
}