summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/mod/_cnt
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-06-09 08:52:12 +0200
committerNoel Grandin <noel@peralex.com>2015-06-09 11:34:31 +0200
commit2a0dda3dfb37f0cb69842f7d569c253d82f53713 (patch)
tree7a762c2fa22651cefb68021250a3fad8811e0f06 /qadevOOo/tests/java/mod/_cnt
parent60f8dd78fa3f19e8bed867f7f5926fcf9a8d8e67 (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/_cnt')
-rw-r--r--qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java20
-rw-r--r--qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java39
-rw-r--r--qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java21
3 files changed, 22 insertions, 58 deletions
diff --git a/qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java b/qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java
index b2f60ed1e265..3d8338077452 100644
--- a/qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java
+++ b/qadevOOo/tests/java/mod/_cnt/ChaosContentProvider.java
@@ -20,7 +20,6 @@ package mod._cnt;
import java.io.PrintWriter;
-import lib.StatusException;
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
@@ -66,24 +65,13 @@ public class ChaosContentProvider extends TestCase {
@Override
public TestEnvironment createTestEnvironment( TestParameters Param,
PrintWriter log )
- throws StatusException {
- XInterface oObj = null;
- Object oInterface = null;
+ throws Exception {
XMultiServiceFactory xMSF = Param.getMSF();
- Object cntFactory = null ;
-
- try {
- oInterface = xMSF.createInstance
+ Object oInterface = xMSF.createInstance
( "com.sun.star.ucb.ChaosContentProvider" );
- cntFactory = xMSF.createInstance
+ Object cntFactory = xMSF.createInstance
( "com.sun.star.comp.ucb.UniversalContentBroker" );
- }
- catch( com.sun.star.uno.Exception e ) {
- log.println("Can't create an object." );
- throw new StatusException( "Can't create an object", e );
- }
-
- oObj = (XInterface) oInterface;
+ XInterface oObj = (XInterface) oInterface;
TestEnvironment tEnv = new TestEnvironment( oObj );
diff --git a/qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java b/qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java
index ee7aebf4e19b..8fc8cd0d9143 100644
--- a/qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java
+++ b/qadevOOo/tests/java/mod/_cnt/CntUnoDataContainer.java
@@ -20,7 +20,6 @@ package mod._cnt;
import java.io.PrintWriter;
-import lib.StatusException;
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
@@ -79,37 +78,27 @@ public class CntUnoDataContainer extends TestCase {
*/
@Override
protected TestEnvironment createTestEnvironment(
- TestParameters Param, PrintWriter log) {
- XInterface oObj = null;
- Object oInterface = null;
+ TestParameters Param, PrintWriter log) throws Exception {
XMultiServiceFactory xMSF = Param.getMSF();
- Object relationContainer = null ;
- Object xIn = null;
- try {
- oInterface = xMSF.createInstance
- ( "com.sun.star.ucb.DataContainer" );
+ Object oInterface = xMSF.createInstance
+ ( "com.sun.star.ucb.DataContainer" );
- // adding one child container
- XIndexContainer xIC = UnoRuntime.queryInterface
- (XIndexContainer.class, oInterface) ;
+ // adding one child container
+ XIndexContainer xIC = UnoRuntime.queryInterface
+ (XIndexContainer.class, oInterface) ;
- Object child = xMSF.createInstance
- ( "com.sun.star.ucb.DataContainer" );
- xIC.insertByIndex(0, child) ;
+ Object child = xMSF.createInstance
+ ( "com.sun.star.ucb.DataContainer" );
+ xIC.insertByIndex(0, child) ;
- relationContainer = xMSF.createInstance
- ( "com.sun.star.ucb.DataContainer" );
+ Object relationContainer = xMSF.createInstance
+ ( "com.sun.star.ucb.DataContainer" );
- xIn = xMSF.createInstance
- ( "com.sun.star.io.DataInputStream" );
- }
- catch( com.sun.star.uno.Exception e ) {
- log.println("Can't create an object." );
- throw new StatusException( "Can't create an object", e );
- }
+ Object xIn = xMSF.createInstance
+ ( "com.sun.star.io.DataInputStream" );
- oObj = (XInterface) oInterface;
+ XInterface oObj = (XInterface) oInterface;
TestEnvironment tEnv = new TestEnvironment( oObj );
diff --git a/qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java b/qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java
index 61ada8c2acd5..93807fe5f486 100644
--- a/qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java
+++ b/qadevOOo/tests/java/mod/_cnt/PropertyMatcherFactory.java
@@ -20,7 +20,6 @@ package mod._cnt;
import java.io.PrintWriter;
-import lib.StatusException;
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
@@ -51,23 +50,11 @@ public class PropertyMatcherFactory extends TestCase {
@Override
public TestEnvironment createTestEnvironment( TestParameters Param,
PrintWriter log )
- throws StatusException {
- XInterface oObj = null;
- Object oInterface = null;
+ throws Exception {
XMultiServiceFactory xMSF = Param.getMSF();
-
-
- try {
- oInterface = xMSF.createInstance
- ( "com.sun.star.ucb.PropertyMatcherFactory" );
-
- }
- catch( com.sun.star.uno.Exception e ) {
- log.println("Can't create an object." );
- throw new StatusException( "Can't create an object", e );
- }
-
- oObj = (XInterface) oInterface;
+ Object oInterface = xMSF.createInstance
+ ( "com.sun.star.ucb.PropertyMatcherFactory" );
+ XInterface oObj = (XInterface) oInterface;
TestEnvironment tEnv = new TestEnvironment( oObj );