summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2009-01-14 03:58:00 (EST)
committerCarsten Drossel2009-01-14 03:58:00 (EST)
commit455c5f050515ea2394ac8be9516e3fd6cfb73d09 (patch)
tree3727d9e05d7bffb0bc6923c9be25c37a0053e6bc
parentbc4fe92cf848f82d86d626f54f02bd04ea7cf851 (diff)
downloadorg.eclipse.riena-455c5f050515ea2394ac8be9516e3fd6cfb73d09.zip
org.eclipse.riena-455c5f050515ea2394ac8be9516e3fd6cfb73d09.tar.gz
org.eclipse.riena-455c5f050515ea2394ac8be9516e3fd6cfb73d09.tar.bz2
handling Checkstyle and FindBugs warnings
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/LazyThing.java5
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/Thing259478.java2
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ReflectionUtilsTest.java16
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/core/util/VariableManagerUtilTest.java1
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/ListRidgetTest.java3
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/tests/RienaTestCase.java1
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/marker/TooltipMessageMarkerViewerTest.java2
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidDecimalTest.java34
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidIntegerTest.java35
9 files changed, 61 insertions, 38 deletions
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/LazyThing.java b/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/LazyThing.java
index 768cca7..2284ad0 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/LazyThing.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/LazyThing.java
@@ -15,9 +15,14 @@ package org.eclipse.riena.core.extension;
*/
public class LazyThing implements ILazyThing {
+ // Ignoring Checkstyle warning about the field not being private:
+ // appears to be ok for testing.
static boolean instantiated;
public LazyThing() {
+ // TODO warning suppression. Ignoring FindBugs problem about
+ // writing to static field. Since this is used only for testing
+ // manipulation of multiple instances is not an issue.
instantiated = true;
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/Thing259478.java b/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/Thing259478.java
index ceb9fa9..26e8cea 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/Thing259478.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/Thing259478.java
@@ -22,6 +22,8 @@ import org.eclipse.riena.core.util.PropertiesUtils;
*/
public class Thing259478 implements IExecutableExtension {
+ // Ignoring Checkstyle warning about the field not being private:
+ // appears to be ok for testing.
public Map<String, String> properties;
public Thing259478() {
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ReflectionUtilsTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ReflectionUtilsTest.java
index 520228d..dd734dd 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ReflectionUtilsTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/ReflectionUtilsTest.java
@@ -194,6 +194,10 @@ public class ReflectionUtilsTest extends RienaTestCase {
*/
@SuppressWarnings("unchecked")
public void testNewLazyInstanceByClass() {
+ // TODO warning suppression. Ignoring FindBugs problem about writing
+ // static field. This test class uses some bad practices to test the
+ // evil stuff done by the class ReflectionUtils that itself should be
+ // used only in other tests.
HaeshMaep.created = false;
Map<String, String> map = ReflectionUtils.newLazyInstance(Map.class, HaeshMaep.class);
assertFalse(HaeshMaep.created);
@@ -206,6 +210,10 @@ public class ReflectionUtilsTest extends RienaTestCase {
*/
@SuppressWarnings("unchecked")
public void testNewLazyInstanceByString() {
+ // TODO warning suppression. Ignoring FindBugs problem about writing
+ // static field. This test class uses some bad practices to test the
+ // evil stuff done by the class ReflectionUtils that itself should be
+ // used only in other tests.
HaeshMaep.created = false;
Map<String, String> map = ReflectionUtils.newLazyInstance(Map.class, HaeshMaep.class.getName());
assertFalse(HaeshMaep.created);
@@ -213,6 +221,8 @@ public class ReflectionUtilsTest extends RienaTestCase {
assertTrue(HaeshMaep.created);
}
+ // Ignoring Checkstyle warning that this class should be final since it
+ // has a subclass (below).
private static class TestClass {
@SuppressWarnings("unused")
@@ -291,6 +301,8 @@ public class ReflectionUtilsTest extends RienaTestCase {
}
}
+ // TODO warning suppression. Ignoring FindBugs problem about HaeshMaep
+ // being public. Making it package protected causes a test failure.
public static class HaeshMaep<K, V> extends HashMap<K, V> {
private static final long serialVersionUID = 1L;
@@ -301,6 +313,10 @@ public class ReflectionUtilsTest extends RienaTestCase {
*/
public HaeshMaep() {
super();
+ // TODO warning suppression. Ignoring FindBugs problem about writing
+ // static field. This test class uses some bad practices to test the
+ // evil stuff done by the class ReflectionUtils that itself should be
+ // used only in other tests.
created = true;
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/VariableManagerUtilTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/VariableManagerUtilTest.java
index 545ba6f..2e294f0 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/VariableManagerUtilTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/core/util/VariableManagerUtilTest.java
@@ -20,6 +20,7 @@ import org.eclipse.riena.tests.collect.NonUITestCase;
/**
* Test the <code>ConfigSymbolReplace</code> class.
*/
+@SuppressWarnings("restriction")
@NonUITestCase
public class VariableManagerUtilTest extends RienaTestCase {
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/ListRidgetTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/ListRidgetTest.java
index c5dede9..9b6a6e0 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/ListRidgetTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/ListRidgetTest.java
@@ -391,6 +391,9 @@ public class ListRidgetTest extends AbstractTableRidgetTest {
assertFalse(ridget.hasMoveableColumns());
+ // TODO warning suppression: Ignore FindBugs warning about the
+ // UnsupportedOperationException being thrown since this is
+ // what the test is all about.
try {
ridget.setMoveableColumns(true);
fail();
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/tests/RienaTestCase.java b/org.eclipse.riena.tests/src/org/eclipse/riena/tests/RienaTestCase.java
index b8ba93e..18d5364 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/tests/RienaTestCase.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/tests/RienaTestCase.java
@@ -40,6 +40,7 @@ import org.osgi.framework.ServiceReference;
* @author campo
*
*/
+@SuppressWarnings("restriction")
public abstract class RienaTestCase extends TestCase {
// Keep track of services and and corresponding service references.
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/marker/TooltipMessageMarkerViewerTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/marker/TooltipMessageMarkerViewerTest.java
index ef52a27..3c37d89 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/marker/TooltipMessageMarkerViewerTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/marker/TooltipMessageMarkerViewerTest.java
@@ -204,7 +204,7 @@ public class TooltipMessageMarkerViewerTest extends TestCase {
* ridget.setToolTipText(...) while the {@link TooltipMessageMarkerViewer}
* is showing an error message.
*/
- public void testBug258540_2() {
+ public void testBug258540Snippet2() {
TextRidget aRidget = new TextRidget();
Text aControl = new Text(shell, SWT.BORDER);
aRidget.setUIControl(aControl);
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidDecimalTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidDecimalTest.java
index 3a89789..cc1fc77 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidDecimalTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidDecimalTest.java
@@ -11,7 +11,6 @@
package org.eclipse.riena.ui.ridgets.validation.tests;
import java.text.DecimalFormat;
-import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;
@@ -415,23 +414,22 @@ public class ValidDecimalTest extends RienaTestCase {
}
- // TODO: Tests for Macedonia (mk_MK) with surrounding brackets
-
- public void _testPrintAvailableLocaleFormats() {
- final double number = -1234.56;
- for (final Locale locale : NumberFormat.getAvailableLocales()) {
- if (locale.getCountry().length() != 0) {
- System.out.print(locale.getDisplayName() + "(" + locale + "): ");
- final NumberFormat format = DecimalFormat.getInstance(locale);
- System.out.print('"' + format.format(number) + '"');
- try {
- System.out.println(" = [" + format.parse(format.format(number)) + ']');
- } catch (ParseException e) {
- System.out.println(" = [cannot reformat to Number]");
- }
- }
- }
- }
+ // TODO: Tests for Macedonia (mk_MK) with surrounding brackets
+ // public void testPrintAvailableLocaleFormats() {
+ // final double number = -1234.56;
+ // for (final Locale locale : NumberFormat.getAvailableLocales()) {
+ // if (locale.getCountry().length() != 0) {
+ // System.out.print(locale.getDisplayName() + "(" + locale + "): ");
+ // final NumberFormat format = DecimalFormat.getInstance(locale);
+ // System.out.print('"' + format.format(number) + '"');
+ // try {
+ // System.out.println(" = [" + format.parse(format.format(number)) + ']');
+ // } catch (ParseException e) {
+ // System.out.println(" = [cannot reformat to Number]");
+ // }
+ // }
+ // }
+ // }
/**
* Tests the method {@code setLocal(String[])}.
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidIntegerTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidIntegerTest.java
index 3431c74..8c02692 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidIntegerTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidIntegerTest.java
@@ -11,8 +11,6 @@
package org.eclipse.riena.ui.ridgets.validation.tests;
import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.text.ParseException;
import java.util.Locale;
import org.eclipse.riena.tests.RienaTestCase;
@@ -291,23 +289,22 @@ public class ValidIntegerTest extends RienaTestCase {
assertFalse(rule.validate(format.format(-12)).isOK());
}
- // TODO: Tests for Macedonia (mk_MK) with surrounding brackets
-
- public void _testPrintAvailableLocaleFormats() {
- final double number = -1234.56;
- for (final Locale locale : NumberFormat.getAvailableLocales()) {
- if (locale.getCountry().length() != 0) {
- System.out.print(locale.getDisplayName() + "(" + locale + "): ");
- final NumberFormat format = DecimalFormat.getInstance(locale);
- System.out.print('"' + format.format(number) + '"');
- try {
- System.out.println(" = [" + format.parse(format.format(number)) + ']');
- } catch (ParseException e) {
- System.out.println(" = [cannot reformat to Number]");
- }
- }
- }
- }
+ // TODO: Tests for Macedonia (mk_MK) with surrounding brackets
+ // public void testPrintAvailableLocaleFormats() {
+ // final double number = -1234.56;
+ // for (final Locale locale : NumberFormat.getAvailableLocales()) {
+ // if (locale.getCountry().length() != 0) {
+ // System.out.print(locale.getDisplayName() + "(" + locale + "): ");
+ // final NumberFormat format = DecimalFormat.getInstance(locale);
+ // System.out.print('"' + format.format(number) + '"');
+ // try {
+ // System.out.println(" = [" + format.parse(format.format(number)) + ']');
+ // } catch (ParseException e) {
+ // System.out.println(" = [cannot reformat to Number]");
+ // }
+ // }
+ // }
+ // }
/**
* Tests the method {@code setInitializationData}.