use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CModuleTest method test_C_getFunction2.
@Test
public void test_C_getFunction2() throws CouldntLoadDataException, LoadCancelledException {
try {
m_module.getContent().getViewContainer().getFunction((INaviView) null);
fail();
} catch (final NullPointerException exception) {
}
m_module.load();
int counter = 0;
final List<INaviFunction> functions = m_module.getContent().getFunctionContainer().getFunctions();
for (final INaviView view : m_module.getContent().getViewContainer().getNativeFlowgraphViews()) {
assertEquals(functions.get(counter), m_module.getContent().getViewContainer().getFunction(view));
counter++;
}
}
use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CPostgreSQLModuleContentTest method testDeleteView.
@Test
public void testDeleteView() throws LoadCancelledException, CouldntLoadDataException, CouldntDeleteException {
final CModule module = (CModule) getDatabase().getContent().getModules().get(0);
module.load();
final CModuleContent moduleContent1 = module.getContent();
assertNotNull(moduleContent1);
final CView view = moduleContent1.getViewContainer().createView("name", "desc");
assertNotNull(view);
try {
moduleContent1.getViewContainer().deleteView(null);
fail();
} catch (final NullPointerException e) {
}
assertEquals(1, moduleContent1.getViewContainer().getCustomViewCount());
moduleContent1.getViewContainer().deleteView(view);
assertEquals(0, moduleContent1.getViewContainer().getCustomViewCount());
try {
moduleContent1.getViewContainer().deleteView(view);
fail();
} catch (final IllegalArgumentException e) {
}
try {
moduleContent1.getViewContainer().deleteView(null);
fail();
} catch (final NullPointerException e) {
}
CView nativeView = null;
for (final INaviView view1 : module.getContent().getViewContainer().getViews()) {
if (view1.getType() == ViewType.Native) {
nativeView = (CView) view1;
}
}
try {
moduleContent1.getViewContainer().deleteView(nativeView);
fail();
} catch (final IllegalStateException e) {
}
try {
moduleContent1.close();
moduleContent1.getViewContainer().deleteView(view);
fail();
} catch (final IllegalStateException e) {
}
}
use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CPostgreSQLModuleContentTest method testCModuleContentConstructor.
@Test
public void testCModuleContentConstructor() throws LoadCancelledException, CouldntLoadDataException {
final CModule module = (CModule) getDatabase().getContent().getModules().get(0);
module.load();
final ListenerProvider<IModuleListener> listeners = new ListenerProvider<IModuleListener>();
final CCallgraph callgraph = module.getContent().getNativeCallgraph();
final IFilledList<INaviFunction> functions = new FilledList<INaviFunction>();
functions.add(module.getContent().getFunctionContainer().getFunctions().get(0));
final ICallgraphView nativeCallgraph = module.getContent().getViewContainer().getNativeCallgraphView();
final ImmutableList<IFlowgraphView> nativeFlowgraphs = module.getContent().getViewContainer().getNativeFlowgraphViews();
final List<INaviView> customViews = new ArrayList<INaviView>();
final ImmutableBiMap<INaviView, INaviFunction> viewFunctionMap = new ImmutableBiMap.Builder<INaviView, INaviFunction>().build();
new Pair<HashMap<INaviView, INaviFunction>, HashMap<INaviFunction, INaviView>>(null, null);
final IFilledList<TraceList> traces = new FilledList<TraceList>();
final SectionContainer sections = new SectionContainer(new SectionContainerBackend(getProvider(), module));
final TypeInstanceContainer instances = new TypeInstanceContainer(new TypeInstanceContainerBackend(getProvider(), module, module.getTypeManager(), sections), getProvider());
final CModuleContent moduleContent1 = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, traces, sections, instances);
assertNotNull(moduleContent1);
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(null, null, null, null, null, null, null, null, null, null, sections, instances);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, null, null, null, null, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), null, null, null, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, null, null, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, null, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, traces, null, null);
fail();
} catch (final NullPointerException e) {
}
}
use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CProjectContainerTest method testDeleteView.
@Test
public void testDeleteView() throws CouldntDeleteException {
final CProjectContainer container = new CProjectContainer(m_database, m_project);
final INaviView view = container.createView("foo", "berT");
assertNotNull(view);
try {
container.deleteView(null);
fail();
} catch (final NullPointerException e) {
}
container.deleteView(view);
assertEquals(2, container.getViews().size());
}
use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CProjectContentTest method testGetTaggedViews2.
@Test
public void testGetTaggedViews2() {
final CProjectContent projectContent = new CProjectContent(m_project, m_listeners, m_provider, m_addressSpaces, m_views, m_traces);
@SuppressWarnings("unused") final INaviView view = new MockView(m_provider);
@SuppressWarnings("unused") final INaviView view2 = projectContent.createView("Name", "description");
assertNotNull(CViewFilter.getTaggedViews(projectContent.getViews(), new CTag(4, "foo", "bar", TagType.VIEW_TAG, m_provider)));
}
Aggregations