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/_sc/ScIndexEnumeration_TextFieldEnumeration.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/_sc/ScIndexEnumeration_TextFieldEnumeration.java')
-rw-r--r-- | qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java | 66 |
1 files changed, 24 insertions, 42 deletions
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java index 244d09c3338e..ea5172c39d99 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java @@ -94,7 +94,7 @@ public class ScIndexEnumeration_TextFieldEnumeration extends TestCase { */ @Override protected synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) { + TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; XText oText = null; @@ -102,47 +102,29 @@ public class ScIndexEnumeration_TextFieldEnumeration extends TestCase { XInterface aField = null; XTextFieldsSupplier xTextFieldsSupp = null; - try { - // we want to create an instance of ScCellFieldObj. - // to do this we must get an MultiServiceFactory. - - XMultiServiceFactory _oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xSheetDoc); - - aField = (XInterface) - _oMSF.createInstance("com.sun.star.text.TextField.URL"); - oContent = UnoRuntime.queryInterface(XTextContent.class, aField); - - XSpreadsheets oSheets = xSheetDoc.getSheets() ; - XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - - XCell oCell = oSheet.getCellByPosition(2,3); - oText = UnoRuntime.queryInterface(XText.class, oCell); - - oText.insertTextContent( - oText.createTextCursor(), oContent, true); - - xTextFieldsSupp = UnoRuntime.queryInterface(XTextFieldsSupplier.class, oCell); - - oObj = xTextFieldsSupp.getTextFields().createEnumeration(); - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } catch (com.sun.star.uno.Exception e) { - log.println("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); - } + // we want to create an instance of ScCellFieldObj. + // to do this we must get an MultiServiceFactory. + + XMultiServiceFactory _oMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xSheetDoc); + + aField = (XInterface) + _oMSF.createInstance("com.sun.star.text.TextField.URL"); + oContent = UnoRuntime.queryInterface(XTextContent.class, aField); + + XSpreadsheets oSheets = xSheetDoc.getSheets() ; + XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); + + XCell oCell = oSheet.getCellByPosition(2,3); + oText = UnoRuntime.queryInterface(XText.class, oCell); + + oText.insertTextContent( + oText.createTextCursor(), oContent, true); + + xTextFieldsSupp = UnoRuntime.queryInterface(XTextFieldsSupplier.class, oCell); + + oObj = xTextFieldsSupp.getTextFields().createEnumeration(); TestEnvironment tEnv = new TestEnvironment(oObj) ; |