use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class BookmarkManagerTest method testAddBookmark.
@Test
public void testAddBookmark() {
m_apiManager.addListener(m_mockListener);
try {
m_apiManager.addBookmark(null, "Fark");
fail();
} catch (final NullPointerException exception) {
}
try {
m_apiManager.addBookmark(new Address(0x123), null);
fail();
} catch (final NullPointerException exception) {
}
m_apiManager.addBookmark(new Address(0x123), "Fark");
try {
m_apiManager.addBookmark(new Address(0x123), "Fark");
fail();
} catch (final IllegalArgumentException exception) {
}
assertEquals(1, m_nativeManager.getNumberOfBookmarks());
assertEquals(0x123, m_nativeManager.getBookmark(0).getAddress().toLong());
assertEquals("Fark", m_nativeManager.getBookmark(0).getDescription());
assertEquals(1, m_apiManager.getNumberOfBookmarks());
assertEquals(0x123, m_apiManager.getBookmark(0).getAddress().toLong());
assertEquals("Fark", m_apiManager.getBookmark(0).getDescription());
assertEquals("addedBookmark/123;", m_mockListener.events);
m_apiManager.removeListener(m_mockListener);
}
use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class BookmarkManagerTest method testRemoveBookmark.
@Test
public void testRemoveBookmark() {
try {
m_apiManager.removeBookmark(null);
fail();
} catch (final NullPointerException exception) {
}
try {
m_apiManager.removeBookmark(new Address(0x123));
fail();
} catch (final NullPointerException exception) {
}
m_apiManager.addBookmark(new Address(0x123), "Fark");
m_apiManager.addListener(m_mockListener);
m_apiManager.removeBookmark(new Address(0x123));
assertEquals(0, m_nativeManager.getNumberOfBookmarks());
assertEquals(0, m_apiManager.getNumberOfBookmarks());
assertEquals("removedBookmark/123;", m_mockListener.events);
m_apiManager.removeListener(m_mockListener);
}
use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class BreakpointHelpersTest method testGetBreakpointsView.
@Test
public void testGetBreakpointsView() {
assertTrue(BreakpointHelpers.getBreakpoints(m_debugger, m_view).isEmpty());
m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1234)))));
m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x123)))));
final List<Address> breakpoints = BreakpointHelpers.getBreakpoints(m_debugger, m_view);
assertEquals(2, breakpoints.size());
assertEquals(0x1234, breakpoints.get(0).toLong());
assertEquals(0x123, breakpoints.get(1).toLong());
try {
BreakpointHelpers.getBreakpoints(null, m_view);
fail();
} catch (final NullPointerException exception) {
}
try {
BreakpointHelpers.getBreakpoints(m_debugger, (View) null);
fail();
} catch (final NullPointerException exception) {
}
}
use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class BreakpointHelpersTest method testGetEchoBreakpointsView.
@Test
public void testGetEchoBreakpointsView() {
assertTrue(BreakpointHelpers.getEchoBreakpoints(m_debugger, m_view).isEmpty());
m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1234)))));
m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x123)))));
final List<Address> breakpoints = BreakpointHelpers.getEchoBreakpoints(m_debugger, m_view);
assertEquals(2, breakpoints.size());
assertEquals(0x1234, breakpoints.get(0).toLong());
assertEquals(0x123, breakpoints.get(1).toLong());
try {
BreakpointHelpers.getEchoBreakpoints(null, m_view);
fail();
} catch (final NullPointerException exception) {
}
try {
BreakpointHelpers.getEchoBreakpoints(m_debugger, (View) null);
fail();
} catch (final NullPointerException exception) {
}
}
use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class BreakpointHelpersTest method testGetBreakpointsNode.
@Test
public void testGetBreakpointsNode() {
assertTrue(BreakpointHelpers.getBreakpoints(m_debugger, m_node).isEmpty());
m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1234)))));
final List<Address> breakpoints = BreakpointHelpers.getBreakpoints(m_debugger, m_node);
assertEquals(1, breakpoints.size());
assertEquals(0x1234, breakpoints.get(0).toLong());
try {
BreakpointHelpers.getBreakpoints(null, m_node);
fail();
} catch (final NullPointerException exception) {
}
try {
BreakpointHelpers.getBreakpoints(m_debugger, (CodeNode) null);
fail();
} catch (final NullPointerException exception) {
}
}
Aggregations