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
diff --git a/simple/src/test/java/org/odftoolkit/simple/form/AbstractFormContainerTest.java b/simple/src/test/java/org/odftoolkit/simple/form/AbstractFormContainerTest.java
index f9a26f9..1e68284 100644
--- a/simple/src/test/java/org/odftoolkit/simple/form/AbstractFormContainerTest.java
+++ b/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 @@
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 @@
} catch (Exception e) {
Logger.getLogger(AbstractFormContainerTest.class.getName()).log(
Level.SEVERE, null, e);
+ Assert.fail();
}
}
@@ -100,6 +100,7 @@
} catch (Exception e) {
Logger.getLogger(AbstractFormContainerTest.class.getName()).log(
Level.SEVERE, null, e);
+ Assert.fail();
}
}
}
diff --git a/simple/src/test/java/org/odftoolkit/simple/form/ButtonTest.java b/simple/src/test/java/org/odftoolkit/simple/form/ButtonTest.java
index fea9e94..0e86ea1 100644
--- a/simple/src/test/java/org/odftoolkit/simple/form/ButtonTest.java
+++ b/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 @@
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 @@
} catch (Exception e) {
Logger.getLogger(ButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -86,6 +85,7 @@
} catch (Exception e) {
Logger.getLogger(ButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -118,6 +118,7 @@
} catch (Exception e) {
Logger.getLogger(ButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -149,6 +150,7 @@
} catch (Exception e) {
Logger.getLogger(ButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -185,6 +187,7 @@
} catch (Exception e) {
Logger.getLogger(ButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -217,6 +220,7 @@
} catch (Exception e) {
Logger.getLogger(ButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
diff --git a/simple/src/test/java/org/odftoolkit/simple/form/CheckBoxTest.java b/simple/src/test/java/org/odftoolkit/simple/form/CheckBoxTest.java
index 5401123..39223c8 100644
--- a/simple/src/test/java/org/odftoolkit/simple/form/CheckBoxTest.java
+++ b/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 @@
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 @@
} 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 @@
} 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 @@
} 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 @@
} 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 @@
} 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 @@
} 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 @@
} catch (Exception e) {
Logger.getLogger(CheckBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail("Failed with " + e.getClass().getName() + ": '" + e.getMessage() + "'");
}
}
diff --git a/simple/src/test/java/org/odftoolkit/simple/form/ComboBoxTest.java b/simple/src/test/java/org/odftoolkit/simple/form/ComboBoxTest.java
index 96dc4df..64b743a 100644
--- a/simple/src/test/java/org/odftoolkit/simple/form/ComboBoxTest.java
+++ b/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 @@
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 @@
} catch (Exception e) {
Logger.getLogger(ComboBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -95,7 +94,7 @@
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 @@
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 @@
Assert.assertEquals(FormListSourceType.SQL, comboBox
.getListSourceType());
Assert.assertEquals("Author", comboBox.getDataField());
-
+
// combo3
comboBox = (ComboBox) iterator.next();
Assert.assertNotNull(comboBox);
diff --git a/simple/src/test/java/org/odftoolkit/simple/form/FieldTest.java b/simple/src/test/java/org/odftoolkit/simple/form/FieldTest.java
index d4bf729..6222ac8 100644
--- a/simple/src/test/java/org/odftoolkit/simple/form/FieldTest.java
+++ b/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 @@
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 @@
} catch (Exception e) {
Logger.getLogger(FieldTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -148,6 +147,7 @@
} catch (Exception e) {
Logger.getLogger(FieldTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -180,6 +180,7 @@
} catch (Exception e) {
Logger.getLogger(FieldTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -211,6 +212,7 @@
} catch (Exception e) {
Logger.getLogger(FieldTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -247,6 +249,7 @@
} catch (Exception e) {
Logger.getLogger(FieldTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -288,12 +291,13 @@
break;
}
}
-
+
textDoc.save(ResourceUtilities
.newTestOutputFile("TestSetFormatValue.odt"));
} catch (Exception e) {
Logger.getLogger(FieldTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
}
diff --git a/simple/src/test/java/org/odftoolkit/simple/form/LabelTest.java b/simple/src/test/java/org/odftoolkit/simple/form/LabelTest.java
index 841a1bb..bb6da7a 100644
--- a/simple/src/test/java/org/odftoolkit/simple/form/LabelTest.java
+++ b/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 @@
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 @@
} catch (Exception e) {
Logger.getLogger(LabelTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -90,6 +89,7 @@
} catch (Exception e) {
Logger.getLogger(LabelTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -122,6 +122,7 @@
} catch (Exception e) {
Logger.getLogger(LabelTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -153,6 +154,7 @@
} catch (Exception e) {
Logger.getLogger(LabelTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
@@ -221,6 +223,7 @@
} catch (Exception e) {
Logger.getLogger(LabelTest.class.getName()).log(Level.SEVERE, null,
e);
+ Assert.fail();
}
}
diff --git a/simple/src/test/java/org/odftoolkit/simple/form/ListBoxTest.java b/simple/src/test/java/org/odftoolkit/simple/form/ListBoxTest.java
index 1fcd7e1..ca4c4bb 100644
--- a/simple/src/test/java/org/odftoolkit/simple/form/ListBoxTest.java
+++ b/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 @@
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 @@
} catch (Exception e) {
Logger.getLogger(ListBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -129,6 +128,7 @@
} catch (Exception e) {
Logger.getLogger(ListBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -161,6 +161,7 @@
} catch (Exception e) {
Logger.getLogger(ListBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -192,6 +193,7 @@
} catch (Exception e) {
Logger.getLogger(ListBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -228,6 +230,7 @@
} catch (Exception e) {
Logger.getLogger(ListBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -267,6 +270,7 @@
} catch (Exception e) {
Logger.getLogger(ListBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
diff --git a/simple/src/test/java/org/odftoolkit/simple/form/RadioButtonTest.java b/simple/src/test/java/org/odftoolkit/simple/form/RadioButtonTest.java
index 704cbf6..f411397 100644
--- a/simple/src/test/java/org/odftoolkit/simple/form/RadioButtonTest.java
+++ b/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 @@
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 @@
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -103,6 +102,7 @@
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -136,6 +136,7 @@
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -168,6 +169,7 @@
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -209,6 +211,7 @@
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -242,6 +245,7 @@
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -273,6 +277,7 @@
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -304,6 +309,7 @@
} catch (Exception e) {
Logger.getLogger(RadioButtonTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
}
diff --git a/simple/src/test/java/org/odftoolkit/simple/form/TextBoxTest.java b/simple/src/test/java/org/odftoolkit/simple/form/TextBoxTest.java
index a4286d5..a14ee02 100644
--- a/simple/src/test/java/org/odftoolkit/simple/form/TextBoxTest.java
+++ b/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 @@
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 @@
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 @@
} catch (Exception e) {
Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -123,6 +123,7 @@
} catch (Exception e) {
Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -154,6 +155,7 @@
} catch (Exception e) {
Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -190,6 +192,7 @@
} catch (Exception e) {
Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
@@ -235,6 +238,7 @@
} catch (Exception e) {
Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE,
null, e);
+ Assert.fail();
}
}
}
diff --git a/simple/src/test/java/org/odftoolkit/simple/integrationtest/JarManifestIT.java b/simple/src/test/java/org/odftoolkit/simple/integrationtest/JarManifestIT.java
index caa9136..fd9fc96 100644
--- a/simple/src/test/java/org/odftoolkit/simple/integrationtest/JarManifestIT.java
+++ b/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 @@
} catch (Exception e) {
LOG.log(Level.SEVERE, null, e);
+ Assert.fail();
}
}
}
diff --git a/simple/src/test/java/org/odftoolkit/simple/integrationtest/PerformanceIT.java b/simple/src/test/java/org/odftoolkit/simple/integrationtest/PerformanceIT.java
index 6374ecd..f4ffd84 100644
--- a/simple/src/test/java/org/odftoolkit/simple/integrationtest/PerformanceIT.java
+++ b/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 @@
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 @@
writeToLog();
} catch (Exception e) {
Logger.getLogger(PerformanceIT.class.getName()).log(Level.SEVERE, null, e);
-
+ Assert.fail();
}
}