public final class TestSharedStringsTable extends TestCase {
public void testCreateNew() {
SharedStringsTable sst = new SharedStringsTable();
CTRst st;
int idx;
// Check defaults
assertNotNull(sst.getItems());
assertEquals(0, sst.getItems().size());
assertEquals(0, sst.getCount());
assertEquals(0, sst.getUniqueCount());
st = CTRst.Factory.newInstance();
st.setT("Hello, World!");
idx = sst.addEntry(st);
assertEquals(0, idx);
assertEquals(1, sst.getCount());
assertEquals(1, sst.getUniqueCount());
//add the same entry again
idx = sst.addEntry(st);
assertEquals(0, idx);
assertEquals(2, sst.getCount());
assertEquals(1, sst.getUniqueCount());
//and again
idx = sst.addEntry(st);
assertEquals(0, idx);
assertEquals(3, sst.getCount());
assertEquals(1, sst.getUniqueCount());
st = CTRst.Factory.newInstance();
st.setT("Second string");
idx = sst.addEntry(st);
assertEquals(1, idx);
assertEquals(4, sst.getCount());
assertEquals(2, sst.getUniqueCount());
//add the same entry again
idx = sst.addEntry(st);
assertEquals(1, idx);
assertEquals(5, sst.getCount());
assertEquals(2, sst.getUniqueCount());
st = CTRst.Factory.newInstance();
CTRElt r = st.addNewR();
CTRPrElt pr = r.addNewRPr();
pr.addNewColor().setRgb(new byte[]{(byte)0xFF, 0, 0}); //red
pr.addNewI().setVal(true); //bold
pr.addNewB().setVal(true); //italic
r.setT("Second string");