From 275f0c7b250d448a8e2658ee2f26d4010628237b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 5 Jun 2015 10:24:36 +0200 Subject: Let JUnit take care of exceptions Inspired by commit 4dd0ac62855c5b9382cac004c7eebb9bed983a2b Change-Id: I6ca29aecde357a3cb5852acfc9b5443761052960 Reviewed-on: https://gerrit.libreoffice.org/16094 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/qa/complex/memCheck/CheckMemoryUsage.java | 14 +++------- .../PersistentWindowTest.java | 30 +++------------------- 2 files changed, 7 insertions(+), 37 deletions(-) (limited to 'vcl') diff --git a/vcl/qa/complex/memCheck/CheckMemoryUsage.java b/vcl/qa/complex/memCheck/CheckMemoryUsage.java index 4d9d56a30cc7..06d49dc89ce2 100644 --- a/vcl/qa/complex/memCheck/CheckMemoryUsage.java +++ b/vcl/qa/complex/memCheck/CheckMemoryUsage.java @@ -163,7 +163,7 @@ public class CheckMemoryUsage * for each given document type. */ @Test - public void loadAndSaveDocuments() + public void loadAndSaveDocuments() throws Exception { int nOk = 0; int nRunThrough = 0; @@ -248,7 +248,7 @@ public class CheckMemoryUsage /** * load and save exact one document */ - private void loadAndSaveNTimesDocument(String _sDocument, int _nCount, String _sStoreExtension) + private void loadAndSaveNTimesDocument(String _sDocument, int _nCount, String _sStoreExtension) throws Exception { System.out.println("Document: " + _sDocument); XComponent xComponent = DesktopTools.loadDoc(getMSF(), _sDocument, null); @@ -277,15 +277,7 @@ public class CheckMemoryUsage } // close the doc XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, xStorable); - try - { - xCloseable.close(true); - } - catch (com.sun.star.util.CloseVetoException e) - { - e.printStackTrace(); - fail("Cannot close document: test is futile, Office will surely use more space."); - } + xCloseable.close(true); } else { diff --git a/vcl/qa/complex/persistent_window_states/PersistentWindowTest.java b/vcl/qa/complex/persistent_window_states/PersistentWindowTest.java index 358e5620ebab..fd91beb4617d 100644 --- a/vcl/qa/complex/persistent_window_states/PersistentWindowTest.java +++ b/vcl/qa/complex/persistent_window_states/PersistentWindowTest.java @@ -282,37 +282,15 @@ public class PersistentWindowTest return docHandle; } - private boolean connect() + private boolean connect() throws Exception { - try - { - connection.setUp(); - } - catch (InterruptedException e) - { - fail("can't connect."); - } - catch (Exception e) - { - fail("can't connect."); - } + connection.setUp(); return true; } - private boolean disconnect() + private boolean disconnect() throws Exception { - try - { - connection.tearDown(); - } - catch (InterruptedException e) - { - fail("can't disconnect."); - } - catch (Exception e) - { - fail("can't disconnect."); - } + connection.tearDown(); return true; } -- cgit v1.2.3