use of com.google.security.zynamics.binnavi.disassembly.Modules.CFunctionContainer in project binnavi by google.
the class ModuleHelpersTest method testGetFunction_3.
@Test
public void testGetFunction_3() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final Database database = new Database(new MockDatabase());
final MockModule mockModule = new MockModule();
final MockSqlProvider provider = new MockSqlProvider();
final CModule internalModule = new CModule(1, "", "", new Date(), new Date(), "00000000000000000000000000000000", "0000000000000000000000000000000000000000", 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, provider);
final CFunction parentFunction = new CFunction(internalModule, new MockView(), new CAddress(0x123), "Mock Function", "Mock Function", "Mock Description", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, provider);
new CFunctionContainer(mockModule, Lists.<INaviFunction>newArrayList(parentFunction));
CFunctionContainerHelper.addFunction(mockModule.getContent().getFunctionContainer(), parentFunction);
final TagManager nodeTagManager = new TagManager(new MockTagManager(com.google.security.zynamics.binnavi.Tagging.TagType.NODE_TAG));
final TagManager viewTagManager = new TagManager(new MockTagManager(com.google.security.zynamics.binnavi.Tagging.TagType.VIEW_TAG));
final Module module = new Module(database, mockModule, nodeTagManager, viewTagManager);
assertEquals(module.getFunctions().get(0), ModuleHelpers.getFunction(module, "Mock Function"));
assertNull(ModuleHelpers.getFunction(module, ""));
try {
ModuleHelpers.getFunction(null, (String) null);
fail();
} catch (final NullPointerException e) {
}
try {
ModuleHelpers.getFunction(module, (String) null);
fail();
} catch (final NullPointerException e) {
}
}
Aggregations