Search in sources :

Example 6 with CCodeBookmarkManager

use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager in project binnavi by google.

the class CBookmarkFunctionsTest method test3DeleteBookmarksNoManager.

@Test
public void test3DeleteBookmarksNoManager() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final MockAddress mockAddress = new MockAddress();
    final MockModule mockModule = new MockModule();
    CBookmarkFunctions.addBookmark(bookmarkManager, mockModule, mockAddress);
    final int[] foo = { 0 };
    try {
        CBookmarkFunctions.deleteBookmarks(null, foo);
        fail();
    } catch (final NullPointerException e) {
    }
}
Also used : CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Example 7 with CCodeBookmarkManager

use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager in project binnavi by google.

the class CCodeBookmarkTableModelTest method test1Simple.

@Test
public void test1Simple() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    assertEquals(3, tableModel.getColumnCount());
    assertEquals(0, tableModel.getRowCount());
}
Also used : CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) Test(org.junit.Test)

Example 8 with CCodeBookmarkManager

use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager in project binnavi by google.

the class CCodeBookmarkTableModelTest method test9checkRemoveListeners.

@Test
public void test9checkRemoveListeners() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    final LinkedHashSet<?> m_daListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(bookmarkManager, "m_listeners"), "m_listeners");
    assertEquals(1, m_daListeners.size());
    final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
    bookmarkManager.addBookmark(bookmark);
    final LinkedHashSet<?> m_bmListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(bookmark, "m_listeners"), "m_listeners");
    assertEquals(1, m_bmListeners.size());
    tableModel.dispose();
    assertTrue(m_daListeners.isEmpty());
    assertTrue(m_bmListeners.isEmpty());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) CCodeBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark) CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Example 9 with CCodeBookmarkManager

use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager in project binnavi by google.

the class CCodeBookmarkTableModelTest method test4getValueAtWorking.

@Test
public void test4getValueAtWorking() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
    bookmarkManager.addBookmark(bookmark);
    final MockAddress mock = new MockAddress();
    assertEquals("burzel", tableModel.getValueAt(0, 2));
    assertEquals(mock.toHexString(), tableModel.getValueAt(0, 1));
    assertEquals("Mock Module", tableModel.getValueAt(0, 0));
}
Also used : CCodeBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark) CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Example 10 with CCodeBookmarkManager

use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager in project binnavi by google.

the class CCodeBookmarkTableModelTest method test6getColumnName.

@Test
public void test6getColumnName() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
    bookmarkManager.addBookmark(bookmark);
    assertEquals("Module", tableModel.getColumnName(0));
    assertEquals("Address", tableModel.getColumnName(1));
    assertEquals("Description", tableModel.getColumnName(2));
}
Also used : CCodeBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark) CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Aggregations

CCodeBookmarkManager (com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager)13 Test (org.junit.Test)13 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)12 MockAddress (com.google.security.zynamics.zylib.disassembly.MockAddress)12 CCodeBookmarkTableModel (com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel)9 CCodeBookmark (com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark)8 LinkedHashSet (java.util.LinkedHashSet)1