diff options
author | Noel Grandin <noel@peralex.com> | 2015-06-09 08:52:12 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-06-09 11:34:31 +0200 |
commit | 2a0dda3dfb37f0cb69842f7d569c253d82f53713 (patch) | |
tree | 7a762c2fa22651cefb68021250a3fad8811e0f06 /qadevOOo/tests/java/mod/_sw/XMLExporter.java | |
parent | 60f8dd78fa3f19e8bed867f7f5926fcf9a8d8e67 (diff) |
remove some unnecessary exception wrapping in the Java tests
Modify createTestEnvironment so that it throws Exception. This
is appropriate for unit testing.
The wrapping adds no value and the calling method already has
a catch(Exception) to handle anything.
Change-Id: I430a414f63d2cbfc3b65ecfde0285509265e5192
Diffstat (limited to 'qadevOOo/tests/java/mod/_sw/XMLExporter.java')
-rw-r--r-- | qadevOOo/tests/java/mod/_sw/XMLExporter.java | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/qadevOOo/tests/java/mod/_sw/XMLExporter.java b/qadevOOo/tests/java/mod/_sw/XMLExporter.java index 53e37a735849..34eee2b5751d 100644 --- a/qadevOOo/tests/java/mod/_sw/XMLExporter.java +++ b/qadevOOo/tests/java/mod/_sw/XMLExporter.java @@ -113,7 +113,7 @@ public class XMLExporter extends TestCase { */ @Override public synchronized TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { final String TEST_STR = "XMLExporter"; @@ -123,20 +123,15 @@ public class XMLExporter extends TestCase { Filter = new FilterChecker(log); Any arg = new Any(new Type(XDocumentHandler.class),Filter); - try { - oObj = (XInterface) xMSF.createInstanceWithArguments( - "com.sun.star.comp.Writer.XMLExporter", new Object[] {arg}); - XExporter xEx = UnoRuntime.queryInterface - (XExporter.class,oObj); - xEx.setSourceDocument(xTextDoc); - - XSimpleText aText = xTextDoc.getText(); - XTextCursor curs = aText.createTextCursor(); - aText.insertString(curs, TEST_STR, false); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log) ; - throw new StatusException("Can't create component.", e) ; - } + oObj = (XInterface) xMSF.createInstanceWithArguments( + "com.sun.star.comp.Writer.XMLExporter", new Object[] {arg}); + XExporter xEx = UnoRuntime.queryInterface + (XExporter.class,oObj); + xEx.setSourceDocument(xTextDoc); + + XSimpleText aText = xTextDoc.getText(); + XTextCursor curs = aText.createTextCursor(); + aText.insertString(curs, TEST_STR, false); // adding tags which must be contained in XML output Filter.addTag("office:document") ; |