use of org.eclipse.scout.rt.ui.html.UiSession in project scout.rt by eclipse.
the class JsonAdapterRegistryTest method testCreateDisposeInSameRequest.
@Test
public void testCreateDisposeInSameRequest() throws Exception {
UiSession session = new UiSessionMock();
IStringField model = new AbstractStringField() {
};
IJsonAdapter<?> adapter = session.getOrCreateJsonAdapter(model, null);
// Note: Additionally, registry contains the "root adapter"
assertEquals(2, UiSessionTestUtility.getJsonAdapterRegistry(session).size());
assertEquals(1, session.currentJsonResponse().adapterMap().size());
assertEquals(0, session.currentJsonResponse().eventList().size());
model.setDisplayText("Test");
assertEquals(2, UiSessionTestUtility.getJsonAdapterRegistry(session).size());
assertEquals(1, session.currentJsonResponse().adapterMap().size());
assertEquals(1, session.currentJsonResponse().eventList().size());
adapter.dispose();
assertEquals(1, UiSessionTestUtility.getJsonAdapterRegistry(session).size());
assertEquals(0, session.currentJsonResponse().adapterMap().size());
assertEquals(0, session.currentJsonResponse().eventList().size());
}
Aggregations