public void writeJndi(List<JndiBinding> jndiBindings, String path) throws IOException {
		try {
			document.open();
			if (path.isEmpty()) {
				addParagraph(getString("Arbre_JNDI"), "jndi.png");
			} else {
				addParagraph(getFormattedString("Arbre_JNDI_pour_contexte", path), "jndi.png");
			}
			new PdfJndiReport(jndiBindings, document).toPdf();
		} catch (final DocumentException e) {
			throw createIOException(e);
		}
		document.close();
	}
@Test
	public void testWriteJndi() throws NamingException, IOException {
		final String contextPath = "comp/env/";
		final Context context = createNiceMock(Context.class);
		final NamingEnumeration<Binding> enumeration = createNiceMock(NamingEnumeration.class);
		expect(context.listBindings("java:" + contextPath)).andReturn(enumeration).anyTimes();
		expect(enumeration.hasMore()).andReturn(true).times(6);
		expect(enumeration.next()).andReturn(new Binding("test value", "test value")).once();
		expect(enumeration.next())
				.andReturn(new Binding("test context", createNiceMock(Context.class))).once();
		expect(enumeration.next()).andReturn(new Binding("", "test")).once();
		expect(enumeration.next())
				.andReturn(new Binding("java:/test context", createNiceMock(Context.class))).once();
		expect(enumeration.next()).andReturn(new Binding("test null classname", null, null)).once();
		expect(enumeration.next()).andThrow(new NamingException("test")).once();

		final ServletContext servletContext = createNiceMock(ServletContext.class);
		expect(servletContext.getServerInfo()).andReturn("Mock").anyTimes();
		replay(servletContext);
		Parameters.initialize(servletContext);

		replay(context);
		replay(enumeration);

		final List<JndiBinding> bindings = JndiBinding.listBindings(context, contextPath);
		final ByteArrayOutputStream output = new ByteArrayOutputStream();
		final PdfOtherReport pdfOtherReport = new PdfOtherReport(TEST_APP, output);
		pdfOtherReport.writeJndi(bindings, contextPath);
		assertNotEmptyAndClear(output);
		verify(context);
		verify(enumeration);
		verify(servletContext);

		final PdfOtherReport pdfOtherReport2 = new PdfOtherReport(TEST_APP, output);
		final List<JndiBinding> bindings2 = Collections.emptyList();
		pdfOtherReport2.writeJndi(bindings2, "");
		assertNotEmptyAndClear(output);
	}