All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jdom2.test.cases.adapters.TestJAXPDOMAdapter Maven / Gradle / Ivy

Go to download

A complete, Java-based solution for accessing, manipulating, and outputting XML data

There is a newer version: 2.0.2
Show newest version
package org.jdom2.test.cases.adapters;

import org.junit.Test;
import org.w3c.dom.Document;

import org.jdom2.JDOMException;
import org.jdom2.adapters.JAXPDOMAdapter;

@SuppressWarnings("javadoc")
public class TestJAXPDOMAdapter {

	@Test
	public void testCreateDocument() throws JDOMException {
		for (int i = 10; i > 0; i--) {
			timeDoc();
		}
	}
	
	private void timeDoc() throws JDOMException {
		long time = System.nanoTime();
		long hash = 0L;
		final int cnt = 1000;
		for (int i = 0; i < cnt; i++) {
			Document doc = new JAXPDOMAdapter().createDocument();
			hash += doc.hashCode();
		}
		time = System.nanoTime() - time;
		System.out.printf("JAXPDOMAdapter Speed %.3f %d\n", (time / 1000000.0) / cnt, hash & 0x01);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy