Skip to content
Browse files

Simple API JUnit tests with caught exception will fail the test now

git-svn-id: https://svn.apache.org/repos/asf/incubator/odf/trunk@1738465 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 5de380d commit a4cb7b1063539ee8bed015a39f13a035e4c4a3f2 @svanteschubert svanteschubert committed Apr 10, 2016
View
5 simple/src/test/java/org/odftoolkit/simple/form/AbstractFormContainerTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -22,7 +22,6 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -75,6 +74,7 @@ public void testCreateForm() {
} catch (Exception e) {
Logger.getLogger(AbstractFormContainerTest.class.getName()).log(
Level.SEVERE, null, e);
+ Assert.fail();
}
}
@@ -100,6 +100,7 @@ public void testRemoveForm() {
} catch (Exception e) {
Logger.getLogger(AbstractFormContainerTest.class.getName()).log(
Level.SEVERE, null, e);
+ Assert.fail();
}
}
}
View
10 simple/src/test/java/org/odftoolkit/simple/form/ButtonTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -22,9 +22,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import junit.framework.Assert;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.odftoolkit.simple.TextDocument;
@@ -66,6 +64,7 @@ public static void createForm() {
} catch (Exception e) {
Logger.getLogger(ButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -86,6 +85,7 @@ public void testCreateButton() {
} catch (Exception e) {
Logger.getLogger(ButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -118,6 +118,7 @@ public void testRemoveButton() {
} catch (Exception e) {
Logger.getLogger(ButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -149,6 +150,7 @@ public void testSetButtonRectangle() {
} catch (Exception e) {
Logger.getLogger(ButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -185,6 +187,7 @@ public void testSetAnchorType() {
} catch (Exception e) {
Logger.getLogger(ButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -217,6 +220,7 @@ public void testSetLabel() {
} catch (Exception e) {
Logger.getLogger(ButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
View
11 simple/src/test/java/org/odftoolkit/simple/form/CheckBoxTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -22,9 +22,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import junit.framework.Assert;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.odftoolkit.simple.TextDocument;
@@ -81,6 +79,7 @@ public static void createForm() {
} catch (Exception e) {
Logger.getLogger(CheckBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
}
}
@@ -133,6 +132,7 @@ public void testRemoveCheckBox() {
} catch (Exception e) {
Logger.getLogger(CheckBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
}
}
@@ -164,6 +164,7 @@ public void testSetCheckBoxRectangle() {
} catch (Exception e) {
Logger.getLogger(CheckBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
}
}
@@ -204,6 +205,7 @@ public void testSetAnchorType() {
} catch (Exception e) {
Logger.getLogger(CheckBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
}
}
@@ -236,6 +238,7 @@ public void testSetLabel() {
} catch (Exception e) {
Logger.getLogger(CheckBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
}
}
@@ -268,6 +271,7 @@ public void testCheckedState() {
} catch (Exception e) {
Logger.getLogger(CheckBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
}
}
@@ -298,6 +302,7 @@ public void testSetValue() {
} catch (Exception e) {
Logger.getLogger(CheckBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
}
}
View
11 simple/src/test/java/org/odftoolkit/simple/form/ComboBoxTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -23,9 +23,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import junit.framework.Assert;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.odftoolkit.simple.TextDocument;
@@ -84,6 +82,7 @@ public static void createForm() {
} catch (Exception e) {
Logger.getLogger(ComboBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -95,7 +94,7 @@ public void testCreateComboBox() {
Form form = textDoc.getFormByName("Test Form");
Iterator<FormControl> iterator = ComboBox.getSimpleIterator(form);
int count = 0;
-
+
// combo1
ComboBox comboBox = (ComboBox) iterator.next();
Assert.assertNotNull(comboBox);
@@ -104,7 +103,7 @@ public void testCreateComboBox() {
ArrayList<String> entries = comboBox.getEntries();
Assert.assertEquals("aa", entries.get(0));
Assert.assertEquals("jj", entries.get(entries.size() - 1));
-
+
// combo2
comboBox = (ComboBox) iterator.next();
Assert.assertNotNull(comboBox);
@@ -115,7 +114,7 @@ public void testCreateComboBox() {
Assert.assertEquals(FormListSourceType.SQL, comboBox
.getListSourceType());
Assert.assertEquals("Author", comboBox.getDataField());
-
+
// combo3
comboBox = (ComboBox) iterator.next();
Assert.assertNotNull(comboBox);
View
12 simple/src/test/java/org/odftoolkit/simple/form/FieldTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -23,9 +23,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import junit.framework.Assert;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.odftoolkit.simple.TextDocument;
@@ -105,6 +103,7 @@ public static void createForm() {
} catch (Exception e) {
Logger.getLogger(FieldTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -148,6 +147,7 @@ public void testCreateField() {
} catch (Exception e) {
Logger.getLogger(FieldTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -180,6 +180,7 @@ public void testRemoveField() {
} catch (Exception e) {
Logger.getLogger(FieldTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -211,6 +212,7 @@ public void testSetFieldRectangle() {
} catch (Exception e) {
Logger.getLogger(FieldTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -247,6 +249,7 @@ public void testSetAnchorType() {
} catch (Exception e) {
Logger.getLogger(FieldTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -288,12 +291,13 @@ public void testSetFormat() {
break;
}
}
-
+
textDoc.save(ResourceUtilities
.newTestOutputFile("TestSetFormatValue.odt"));
} catch (Exception e) {
Logger.getLogger(FieldTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
}
View
9 simple/src/test/java/org/odftoolkit/simple/form/LabelTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -22,9 +22,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import junit.framework.Assert;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.odftoolkit.simple.TextDocument;
@@ -70,6 +68,7 @@ public static void createForm() {
} catch (Exception e) {
Logger.getLogger(LabelTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -90,6 +89,7 @@ public void testCreateLabel() {
} catch (Exception e) {
Logger.getLogger(LabelTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -122,6 +122,7 @@ public void testRemoveLabel() {
} catch (Exception e) {
Logger.getLogger(LabelTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -153,6 +154,7 @@ public void testSetLabelRectangle() {
} catch (Exception e) {
Logger.getLogger(LabelTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -221,6 +223,7 @@ public void testSetLabel() {
} catch (Exception e) {
Logger.getLogger(LabelTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
View
10 simple/src/test/java/org/odftoolkit/simple/form/ListBoxTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -23,9 +23,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import junit.framework.Assert;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.odftoolkit.simple.TextDocument;
@@ -86,6 +84,7 @@ public static void createForm() {
} catch (Exception e) {
Logger.getLogger(ListBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -129,6 +128,7 @@ public void testCreateListBox() {
} catch (Exception e) {
Logger.getLogger(ListBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -161,6 +161,7 @@ public void testRemoveListBox() {
} catch (Exception e) {
Logger.getLogger(ListBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -192,6 +193,7 @@ public void testSetListBoxRectangle() {
} catch (Exception e) {
Logger.getLogger(ListBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -228,6 +230,7 @@ public void testSetAnchorType() {
} catch (Exception e) {
Logger.getLogger(ListBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -267,6 +270,7 @@ public void testSetProperties() {
} catch (Exception e) {
Logger.getLogger(ListBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
View
12 simple/src/test/java/org/odftoolkit/simple/form/RadioButtonTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -22,9 +22,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import junit.framework.Assert;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.odftoolkit.simple.TextDocument;
@@ -81,6 +79,7 @@ public static void createForm() {
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -103,6 +102,7 @@ public void testCreateRadioButton() {
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -136,6 +136,7 @@ public void testRemoveRadioButton() {
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -168,6 +169,7 @@ public void testSetRadioButtonRectangle() {
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -209,6 +211,7 @@ public void testSetAnchorType() {
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -242,6 +245,7 @@ public void testSetLabel() {
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -273,6 +277,7 @@ public void testCheckedState() {
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -304,6 +309,7 @@ public void testSetValue() {
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
}
View
12 simple/src/test/java/org/odftoolkit/simple/form/TextBoxTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -22,9 +22,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import junit.framework.Assert;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.odftoolkit.simple.TextDocument;
@@ -63,13 +61,14 @@ public static void createForm() {
Cell cell = table.getCellByPosition("B1");
para = cell.addParagraph("Insert a text box here.");
form.createTextBox(para, textBoxRtg, "TextBox3", "TextBox3", false);
-
+
doc.save(ResourceUtilities
.newTestOutputFile("TestCreateTextBox.odt"));
} catch (Exception e) {
Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -91,6 +90,7 @@ public void testCreateCheckBox() {
} catch (Exception e) {
Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -123,6 +123,7 @@ public void testRemoveCheckBox() {
} catch (Exception e) {
Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -154,6 +155,7 @@ public void testSetTextBoxRectangle() {
} catch (Exception e) {
Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -190,6 +192,7 @@ public void testSetAnchorType() {
} catch (Exception e) {
Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -235,6 +238,7 @@ public void testSetTextContent() {
} catch (Exception e) {
Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
}
View
13 simple/src/test/java/org/odftoolkit/simple/integrationtest/JarManifestIT.java
@@ -1,20 +1,20 @@
/************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
- *
+ *
* Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved.
- *
+ *
* Use is subject to license terms.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0. You can also
* obtain a copy of the License at http://odftoolkit.org/docs/license.txt
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*
@@ -25,9 +25,7 @@
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;
-
import junit.framework.Assert;
-
import org.junit.Test;
import org.odftoolkit.simple.JarManifest;
@@ -79,6 +77,7 @@ public void testJar() {
} catch (Exception e) {
LOG.log(Level.SEVERE, null, e);
+ Assert.fail();
}
}
}
View
6 simple/src/test/java/org/odftoolkit/simple/integrationtest/PerformanceIT.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -25,7 +25,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
-
+import junit.framework.Assert;
import org.junit.Test;
import org.odftoolkit.odfdom.dom.OdfDocumentNamespace;
import org.odftoolkit.odfdom.dom.element.office.OfficeSpreadsheetElement;
@@ -94,7 +94,7 @@ public void testPerformance() {
writeToLog();
} catch (Exception e) {
Logger.getLogger(PerformanceIT.class.getName()).log(Level.SEVERE, null, e);
-
+ Assert.fail();
}
}

0 comments on commit a4cb7b1

Please sign in to comment.
Something went wrong with that request. Please try again.