@Test public void testUIContextSerialization() { MyApplication app = (MyApplication) UIRegistry.getInstance().getUI(MyApplication.class. getName()); UIContextImpl uic = new UIContextImpl(); setActiveContext(uic); uic.setUI(app); WTextField name = app.getText(); name.setText(TEST_STRING); Assert.assertEquals("Initial text incorrect", TEST_STRING, name.getText()); // Pipe the ui context uic = (UIContextImpl) pipe(uic); setActiveContext(uic); // Components returned should be the same instance MyApplication pipedApp = (MyApplication) uic.getUI(); Assert.assertSame("Should be the same component instance", app, pipedApp); Assert.assertSame("Should be the same text field instance", app.getText(), pipedApp. getText()); Assert.assertEquals("Text incorrect after serialization", TEST_STRING, name.getText()); }