Fix NPE in TreasureData#addEventWithCallback
Refactor TreasureData class and add some tests to TreasureDataTest