@Test
public void testUpdateCode() throws Exception {

    String label = "Hello";
    String note = "note";
    String code = "http://thesaurus.test#0";
    String lang = "eng";
    KeywordBean keyword = new KeywordBean(isoLangMapper)
        .setUriCode(code)
        .setDefinition(note, lang)
        .setValue(label, lang);
    writableThesaurus.addElement(keyword);
    QueryBuilder<KeywordBean> builder = QueryBuilder.keywordQueryBuilder(isoLangMapper, "eng").where(Wheres.ID(code));
    assertEquals(1, builder.build().execute(writableThesaurus).size());
    writableThesaurus.updateCode(keyword.getNameSpaceCode(), keyword.getRelativeCode(), "10");
    assertEquals(0, builder.build().execute(writableThesaurus).size());
    builder.where(Wheres.ID(keyword.getNameSpaceCode() + 10));
    assertEquals(1, builder.build().execute(writableThesaurus).size());
    keyword.setRelativeCode("10");
    writableThesaurus.updateCode(keyword, "15");
    assertEquals(0, builder.build().execute(writableThesaurus).size());
    builder.where(Wheres.ID(keyword.getNameSpaceCode() + 15));
    assertEquals(1, builder.build().execute(writableThesaurus).size());
    writableThesaurus.updateCodeByURI(keyword.getNameSpaceCode() + 15, "http://thesaurus.test#101");
    assertEquals(0, builder.build().execute(writableThesaurus).size());
    builder.where(Wheres.ID("http://thesaurus.test#101"));
    assertEquals(1, builder.build().execute(writableThesaurus).size());
    writableThesaurus.updateCodeByURI("http://thesaurus.test#101", "http://not.namespace.based.ids/101");
    assertEquals(0, builder.build().execute(writableThesaurus).size());
    builder.where(Wheres.ID("http://not.namespace.based.ids/101"));
    assertEquals(1, builder.build().execute(writableThesaurus).size());
}