diff options
author | Noel Grandin <noel@peralex.com> | 2015-06-05 10:24:36 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-06-05 13:17:50 +0000 |
commit | 275f0c7b250d448a8e2658ee2f26d4010628237b (patch) | |
tree | 9537d17adfe0f098a27f84c0f0710b6ba2592aeb /forms | |
parent | 9eb1bfcbb164a8d029d7ba92947e0c9caf8e0826 (diff) |
Let JUnit take care of exceptions
Inspired by commit
4dd0ac62855c5b9382cac004c7eebb9bed983a2b
Change-Id: I6ca29aecde357a3cb5852acfc9b5443761052960
Reviewed-on: https://gerrit.libreoffice.org/16094
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'forms')
-rw-r--r-- | forms/qa/complex/forms/CheckOGroupBoxModel.java | 47 |
1 files changed, 8 insertions, 39 deletions
diff --git a/forms/qa/complex/forms/CheckOGroupBoxModel.java b/forms/qa/complex/forms/CheckOGroupBoxModel.java index 3c53c3498745..1cf2ceb85c39 100644 --- a/forms/qa/complex/forms/CheckOGroupBoxModel.java +++ b/forms/qa/complex/forms/CheckOGroupBoxModel.java @@ -18,7 +18,6 @@ package complex.forms; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import java.util.ArrayList; @@ -43,7 +42,6 @@ import com.sun.star.lang.EventObject; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.CloseVetoException; import com.sun.star.util.XCloseable; /** @@ -54,42 +52,28 @@ public class CheckOGroupBoxModel private XMultiPropertySet m_xPropSet; private XComponent m_xDrawDoc; - @Before public void before() + @Before public void before() throws Exception { SOfficeFactory SOF = SOfficeFactory.getFactory(getMSF()); - try - { - System.out.println("creating a draw document"); - m_xDrawDoc = SOF.createDrawDoc(null); - } - catch (com.sun.star.uno.Exception e) - { - fail("Couldn't create document."); - } + System.out.println("creating a draw document"); + m_xDrawDoc = SOF.createDrawDoc(null); String objName = "GroupBox"; XControlShape shape = FormTools.insertControlShape(m_xDrawDoc, 5000, 7000, 2000, 2000, objName); m_xPropSet = UnoRuntime.queryInterface(XMultiPropertySet.class, shape.getControl()); } - @After public void after() + @After public void after() throws Exception { XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, m_xDrawDoc); if (xClose != null) { - try - { - xClose.close(true); - } - catch (CloseVetoException ex) - { - fail("Can't close document. Exception caught: " + ex.getMessage()); - /* ignore! */ - } + xClose.close(true); } } - @Test public void setPropertyValues() + + @Test public void setPropertyValues() throws Exception { String[] boundPropsToTest = getBoundPropsToTest(); @@ -103,22 +87,7 @@ public class CheckOGroupBoxModel { newValue[i] = ValueChanger.changePValue(gValues[i]); } - try - { - m_xPropSet.setPropertyValues(boundPropsToTest, newValue); - } - catch (com.sun.star.beans.PropertyVetoException e) - { - fail("Exception occurred while trying to change the properties."); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - fail("Exception occurred while trying to change the properties."); - } - catch (com.sun.star.lang.WrappedTargetException e) - { - fail("Exception occurred while trying to change the properties."); - } // end of try-catch + m_xPropSet.setPropertyValues(boundPropsToTest, newValue); assertTrue("Listener was not called.", ml.wasListenerCalled()); m_xPropSet.removePropertiesChangeListener(ml); |