use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.CModuleNode in project binnavi by google.
the class CModuleNodeTest method testUnloadedClosed.
@Test
public void testUnloadedClosed() throws CouldntLoadDataException, CouldntDeleteException, LoadCancelledException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final CModuleNode node = new CModuleNode(m_tree, new DefaultMutableTreeNode(), m_database, m_module, new CModuleContainer(m_database, m_module));
assertEquals("Name (55/66)", node.toString());
m_module.load();
assertEquals("Name (1/0)", node.toString());
final CView view = m_module.getContent().getViewContainer().createView("Foo", "Bar");
assertEquals("Name (1/1)", node.toString());
m_module.getContent().getViewContainer().deleteView(view);
assertEquals("Name (1/0)", node.toString());
m_module.close();
node.dispose();
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_module, "m_listeners"), "m_listeners")).isEmpty());
}
use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.CModuleNode in project binnavi by google.
the class CModuleNodeTest method testUnloaded.
@Test
public void testUnloaded() throws CouldntLoadDataException, CouldntDeleteException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, LoadCancelledException {
final CModuleNode node = new CModuleNode(m_tree, new DefaultMutableTreeNode(), m_database, m_module, new CModuleContainer(m_database, m_module));
assertEquals("Name (55/66)", node.toString());
m_module.load();
assertEquals("Name (1/0)", node.toString());
final CView view = m_module.getContent().getViewContainer().createView("Foo", "Bar");
assertEquals("Name (1/1)", node.toString());
m_module.getContent().getViewContainer().deleteView(view);
assertEquals("Name (1/0)", node.toString());
node.dispose();
final LinkedHashSet<?> viewListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(view, "m_listeners"), "m_listeners");
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_module, "m_listeners"), "m_listeners")).isEmpty());
assertTrue(viewListeners.isEmpty());
}
Aggregations