summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2009-04-30 03:44:26 (EDT)
committerCarsten Drossel2009-04-30 03:44:26 (EDT)
commita366cda0b818febc0c04d624b6bd25e62f664a7d (patch)
tree155cfbac09eba652e1fc0daccec98e614ec309dd
parent541f0bf4bf1bc9c5080b2091a4928c4c4e23c1b8 (diff)
downloadorg.eclipse.riena-a366cda0b818febc0c04d624b6bd25e62f664a7d.zip
org.eclipse.riena-a366cda0b818febc0c04d624b6bd25e62f664a7d.tar.gz
org.eclipse.riena-a366cda0b818febc0c04d624b6bd25e62f664a7d.tar.bz2
handling compile, checkstyle and findbugs warnings
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/attachment/AttachmentClientITest.java3
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactoryTest.java3
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/proxyselector/CoreNetProxySelectorTest.java2
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/proxyselector/ProxySelectorConfigurationTest.java2
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/core/injector/extension/ExtensionInjectorWithWiringTest.java6
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/core/injector/extension/Wireable.java8
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/navigation/ui/filter/AbstractUIFilterRuleRidgetMarkerTest.java2
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/CompositeTableRidgetTest.java9
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/DateTimeRidgetTest.java2
-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/internal/ui/ridgets/swt/MenuItemRidgetTest.java4
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TableRidgetTest.java6
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TreeTableRidgetTest.java21
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/LnFUpdaterTest.java17
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/ModuleViewTest.java3
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/NavigationViewFactoryTest.java24
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleViewTest.java2
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/tests/RienaTestCase.java5
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/MaxNumberLengthTest.java13
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidDecimalTest.java2
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidExpressionTest.java12
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidRangeTest.java19
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidatorCollectionTest.java5
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/ui/swt/utils/SWTBindingPropertyLocatorTest.java2
24 files changed, 100 insertions, 75 deletions
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/attachment/AttachmentClientITest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/attachment/AttachmentClientITest.java
index 0645c82..7352134 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/attachment/AttachmentClientITest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/attachment/AttachmentClientITest.java
@@ -242,6 +242,9 @@ public final class AttachmentClientITest extends RienaTestCase {
* @throws IOException
*/
public void testSendAndDeleteFile() throws IOException {
+ // TODO warning suppression. Ignoring FindBugs problem about
+ // hard coded reference to an absolute pathname. Appears to
+ // be ok for testing.
File file = new File("/testattachments.txt");
OutputStream out = null;
try {
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactoryTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactoryTest.java
index 741f87e..a7f93e0 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactoryTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactoryTest.java
@@ -103,8 +103,7 @@ public class RemoteServiceFactoryTest extends RienaTestCase {
public void testUnregisterForOtherBundleAndStopOtherBundle() throws Exception {
super.startBundle("org.eclipse.riena.communication.console");
BundleContext context = org.eclipse.riena.internal.communication.console.Activator.getDefault().getContext();
- IRemoteServiceRegistration createAndRegisterProxy = new RemoteServiceFactory().createAndRegisterProxy(
- IRSFTest.class, "http://localhost", "hessian", context);
+ new RemoteServiceFactory().createAndRegisterProxy(IRSFTest.class, "http://localhost", "hessian", context);
Object service = context.getService(context.getServiceReference(IRSFTest.class.getName()));
assertNotNull(service);
context.getBundle().stop();
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/proxyselector/CoreNetProxySelectorTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/proxyselector/CoreNetProxySelectorTest.java
index fe75fe6..1358369 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/proxyselector/CoreNetProxySelectorTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/proxyselector/CoreNetProxySelectorTest.java
@@ -45,7 +45,7 @@ public class CoreNetProxySelectorTest extends RienaTestCase {
assertEquals(2, proxies.size());
assertEquals("idproxy", ((InetSocketAddress) proxies.get(0).address()).getHostName());
assertEquals(3128, ((InetSocketAddress) proxies.get(0).address()).getPort());
- } catch (Exception e) {
+ } catch (Throwable e) {
fail();
} finally {
server.stop();
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/proxyselector/ProxySelectorConfigurationTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/proxyselector/ProxySelectorConfigurationTest.java
index 21f2d45..26fd42c 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/proxyselector/ProxySelectorConfigurationTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/communication/core/proxyselector/ProxySelectorConfigurationTest.java
@@ -84,7 +84,7 @@ public class ProxySelectorConfigurationTest extends RienaTestCase {
}
@SuppressWarnings("restriction")
- private final class ProxySelectorExtension implements IProxySelectorExtension {
+ private static final class ProxySelectorExtension implements IProxySelectorExtension {
private int order;
private String name;
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/core/injector/extension/ExtensionInjectorWithWiringTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/core/injector/extension/ExtensionInjectorWithWiringTest.java
index 721d2a3..fe7e8e7 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/core/injector/extension/ExtensionInjectorWithWiringTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/core/injector/extension/ExtensionInjectorWithWiringTest.java
@@ -34,6 +34,9 @@ public class ExtensionInjectorWithWiringTest extends RienaTestCase {
getContext());
IWireData data = target.getData();
assertNotNull(data);
+ // TODO warning suppression. Ignoring three FindBugs problems below
+ // about writing to static field. Since this is used only for testing
+ // manipulation of multiple instances is not an issue.
Wireable.wired = false;
assertTrue(data.createObjectTypeWithWire().isWired());
Wireable.wired = false;
@@ -61,6 +64,9 @@ public class ExtensionInjectorWithWiringTest extends RienaTestCase {
getContext());
IWireData data = target.getData();
assertNotNull(data);
+ // TODO warning suppression. Ignoring three FindBugs problems below
+ // about writing to static field. Since this is used only for testing
+ // manipulation of multiple instances is not an issue.
Wireable.wired = false;
assertFalse(data.createObjectTypeWithWire().isWired());
Wireable.wired = false;
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/core/injector/extension/Wireable.java b/org.eclipse.riena.tests/src/org/eclipse/riena/core/injector/extension/Wireable.java
index 6151c18..a56efa0 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/core/injector/extension/Wireable.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/core/injector/extension/Wireable.java
@@ -18,16 +18,20 @@ import org.eclipse.riena.core.wire.WireWith;
@WireWith(WirableWiring.class)
public class Wireable implements IWireable {
+ // ignore Checkstyle warning: field is not private for testing.
static boolean wired;
- /* (non-Javadoc)
+ /**
* @see org.eclipse.riena.core.injector.extension.IWireable#setWired(boolean)
*/
public void setWired(boolean wired) {
+ // 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.
Wireable.wired = wired;
}
- /* (non-Javadoc)
+ /**
* @see org.eclipse.riena.core.injector.extension.IWireable#isWired()
*/
public boolean isWired() {
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/navigation/ui/filter/AbstractUIFilterRuleRidgetMarkerTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/navigation/ui/filter/AbstractUIFilterRuleRidgetMarkerTest.java
index 7bb7640..f3f6ef3 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/navigation/ui/filter/AbstractUIFilterRuleRidgetMarkerTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/navigation/ui/filter/AbstractUIFilterRuleRidgetMarkerTest.java
@@ -89,7 +89,7 @@ public class AbstractUIFilterRuleRidgetMarkerTest extends TestCase {
}
- private class MyUIFilterRule extends AbstractUIFilterRuleRidgetMarker {
+ private static class MyUIFilterRule extends AbstractUIFilterRuleRidgetMarker {
public MyUIFilterRule() {
super("*", new MandatoryMarker(false));
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/CompositeTableRidgetTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/CompositeTableRidgetTest.java
index 053e843..61decf2 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/CompositeTableRidgetTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/CompositeTableRidgetTest.java
@@ -11,6 +11,7 @@
package org.eclipse.riena.internal.ui.ridgets.swt;
import java.beans.PropertyChangeEvent;
+import java.io.Serializable;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
@@ -660,7 +661,9 @@ public class CompositeTableRidgetTest extends AbstractTableRidgetTest {
/**
* Compares Persons by first name.
*/
- private static final class FirstNameComparator implements Comparator<Object> {
+ private static final class FirstNameComparator implements Comparator<Object>, Serializable {
+ private static final long serialVersionUID = 1L;
+
public int compare(Object o1, Object o2) {
Person p1 = (Person) o1;
Person p2 = (Person) o2;
@@ -671,7 +674,9 @@ public class CompositeTableRidgetTest extends AbstractTableRidgetTest {
/**
* Compares Persons by last name.
*/
- private static final class LastNameComparator implements Comparator<Object> {
+ private static final class LastNameComparator implements Comparator<Object>, Serializable {
+ private static final long serialVersionUID = 1L;
+
public int compare(Object o1, Object o2) {
Person p1 = (Person) o1;
Person p2 = (Person) o2;
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/DateTimeRidgetTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/DateTimeRidgetTest.java
index 24165ea..85b30ff 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/DateTimeRidgetTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/DateTimeRidgetTest.java
@@ -248,7 +248,7 @@ public class DateTimeRidgetTest extends AbstractSWTRidgetTest {
handleValidationSetDate(ValidationTime.ON_UI_CONTROL_EDIT);
}
- public void testValidationWidgetModificationonUpdateRules() {
+ public void testValidationWidgetModificationOnUpdateRules() {
String country = Locale.getDefault().getCountry();
if ("DE".equals(country)) {
handleValidationWidgetModification(ValidationTime.ON_UPDATE_TO_MODEL, "10.04.2009");
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 787fecb..f48e16d 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
@@ -294,6 +294,9 @@ public class ListRidgetTest extends AbstractTableRidgetTest {
ListRidget ridget = getRidget();
try {
+ // TODO warning suppression: Ignore FindBugs warning about the
+ // UnsupportedOperationException being thrown since this is
+ // what the test is all about.
ridget.setColumnSortable(0, true);
fail();
} catch (UnsupportedOperationException uoe) {
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MenuItemRidgetTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MenuItemRidgetTest.java
index 6c88e44..08e5240 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MenuItemRidgetTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/MenuItemRidgetTest.java
@@ -250,9 +250,7 @@ public class MenuItemRidgetTest extends AbstractSWTRidgetTest {
assertTrue(ridget.isEnabled());
assertTrue(item.isEnabled());
- if (ridget instanceof IBasicMarkableRidget) {
- assertEquals(0, ((IBasicMarkableRidget) ridget).getMarkersOfType(DisabledMarker.class).size());
- }
+ assertEquals(0, ((IBasicMarkableRidget) ridget).getMarkersOfType(DisabledMarker.class).size());
}
// helping methods
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TableRidgetTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TableRidgetTest.java
index 82a1bbd..233cd3f 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TableRidgetTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TableRidgetTest.java
@@ -736,7 +736,7 @@ public class TableRidgetTest extends AbstractTableRidgetTest {
}
};
final String lastName = person1.getLastname();
- final String upperCaseName = lastName.toUpperCase();
+ final String lastNameUpperCase = lastName.toUpperCase();
try {
ridget.setColumnFormatter(-1, formatter);
@@ -758,11 +758,11 @@ public class TableRidgetTest extends AbstractTableRidgetTest {
ridget.updateFromModel();
- assertEquals(upperCaseName, table.getItem(0).getText(1));
+ assertEquals(lastNameUpperCase, table.getItem(0).getText(1));
ridget.setColumnFormatter(1, null);
- assertEquals(upperCaseName, table.getItem(0).getText(1));
+ assertEquals(lastNameUpperCase, table.getItem(0).getText(1));
ridget.updateFromModel();
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TreeTableRidgetTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TreeTableRidgetTest.java
index 3580956..5562569 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TreeTableRidgetTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TreeTableRidgetTest.java
@@ -13,14 +13,6 @@ package org.eclipse.riena.internal.ui.ridgets.swt;
import java.beans.PropertyChangeEvent;
import java.util.Comparator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-
import org.eclipse.riena.beans.common.Person;
import org.eclipse.riena.beans.common.TypedComparator;
import org.eclipse.riena.beans.common.WordNode;
@@ -35,6 +27,13 @@ import org.eclipse.riena.ui.ridgets.ISelectableRidget.SelectionType;
import org.eclipse.riena.ui.ridgets.swt.ColumnFormatter;
import org.eclipse.riena.ui.ridgets.swt.uibinding.SwtControlRidgetMapper;
import org.eclipse.riena.ui.ridgets.tree2.TreeNode;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
/**
* Tests of the class {@link TreeTableRidget}.
@@ -648,7 +647,7 @@ public class TreeTableRidgetTest extends AbstractSWTRidgetTest {
}
};
final String lastName = node1.getLastname();
- final String upperCaseName = lastName.toUpperCase();
+ final String lastNameUpperCase = lastName.toUpperCase();
try {
ridget.setColumnFormatter(-1, formatter);
@@ -670,11 +669,11 @@ public class TreeTableRidgetTest extends AbstractSWTRidgetTest {
ridget.updateFromModel();
- assertEquals(upperCaseName, tree.getItem(0).getText(1));
+ assertEquals(lastNameUpperCase, tree.getItem(0).getText(1));
ridget.setColumnFormatter(1, null);
- assertEquals(upperCaseName, tree.getItem(0).getText(1));
+ assertEquals(lastNameUpperCase, tree.getItem(0).getText(1));
ridget.updateFromModel();
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/LnFUpdaterTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/LnFUpdaterTest.java
index 7c9478e..e473d0a 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/LnFUpdaterTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/LnFUpdaterTest.java
@@ -16,6 +16,14 @@ import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.util.Map;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
import org.eclipse.riena.core.util.ReflectionUtils;
import org.eclipse.riena.tests.RienaTestCase;
import org.eclipse.riena.tests.collect.UITestCase;
@@ -26,13 +34,6 @@ import org.eclipse.riena.ui.swt.lnf.ILnfTheme;
import org.eclipse.riena.ui.swt.lnf.LnFUpdater;
import org.eclipse.riena.ui.swt.lnf.LnfManager;
import org.eclipse.riena.ui.swt.utils.SwtUtilities;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
/**
* Tests of the class {@link LnFUpdater}.
@@ -265,7 +266,7 @@ public class LnFUpdaterTest extends RienaTestCase {
}
- private class MyTheme implements ILnfTheme {
+ private static class MyTheme implements ILnfTheme {
public void addCustomColors(Map<String, ILnfResource> table) {
table.put("Label.foreground", new ColorLnfResource(1, 2, 3));
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/ModuleViewTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/ModuleViewTest.java
index 4628f1b..d381ca6 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/ModuleViewTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/ModuleViewTest.java
@@ -34,6 +34,7 @@ public class ModuleViewTest extends RienaTestCase {
@Override
protected void setUp() throws Exception {
+ super.setUp();
shell = new Shell();
view = new ModuleView(shell);
@@ -57,6 +58,8 @@ public class ModuleViewTest extends RienaTestCase {
view.dispose();
SwtUtilities.disposeWidget(shell);
node = null;
+
+ super.tearDown();
}
/**
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/NavigationViewFactoryTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/NavigationViewFactoryTest.java
index 297ef51..03380fa 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/NavigationViewFactoryTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/NavigationViewFactoryTest.java
@@ -34,12 +34,12 @@ public class NavigationViewFactoryTest extends RienaTestCase {
ModuleView moduleView = viewFactory.createModuleView(new Shell());
- assertTrue(moduleView instanceof ModuleView);
+ assertNotNull(moduleView);
assertTrue(moduleView.getClass() == ModuleView.class);
ModuleGroupView moduleGroupView = viewFactory.createModuleGroupView(new Shell());
- assertTrue(moduleGroupView instanceof ModuleGroupView);
+ assertNotNull(moduleGroupView);
assertTrue(moduleGroupView.getClass() == ModuleGroupView.class);
}
@@ -54,12 +54,12 @@ public class NavigationViewFactoryTest extends RienaTestCase {
ModuleView moduleView = viewFactory.createModuleView(new Shell());
- assertTrue(moduleView instanceof ModuleView);
+ assertNotNull(moduleView);
assertTrue(moduleView.getClass() == ModuleView.class);
ModuleGroupView moduleGroupView = viewFactory.createModuleGroupView(new Shell());
- assertTrue(moduleGroupView instanceof ModuleGroupView);
+ assertNotNull(moduleGroupView);
assertTrue(moduleGroupView.getClass() == ModuleGroupView.class);
}
@@ -75,20 +75,20 @@ public class NavigationViewFactoryTest extends RienaTestCase {
ModuleView moduleView = viewFactory.createModuleView(new Shell());
- assertTrue(moduleView instanceof ModuleView);
+ assertNotNull(moduleView);
assertTrue(moduleView.getClass() == TestModuleView.class);
ModuleController moduleController = viewFactory.createModuleController(new ModuleNode());
- assertTrue(moduleController instanceof ModuleController);
+ assertNotNull(moduleController);
assertTrue(moduleController.getClass() == SWTModuleController.class);
ModuleGroupView moduleGroupView = viewFactory.createModuleGroupView(new Shell());
- assertTrue(moduleGroupView instanceof ModuleGroupView);
+ assertNotNull(moduleGroupView);
assertTrue(moduleGroupView.getClass() == TestModuleGroupView.class);
ModuleGroupController moduleGroupController = viewFactory.createModuleGroupController(new ModuleGroupNode());
- assertTrue(moduleGroupController instanceof ModuleGroupController);
+ assertNotNull(moduleGroupController);
assertTrue(moduleGroupController.getClass() == ModuleGroupController.class);
this.removeExtension("org.eclipse.riena.test.navigationModuleView");
@@ -107,20 +107,20 @@ public class NavigationViewFactoryTest extends RienaTestCase {
ModuleView moduleView = viewFactory.createModuleView(new Shell());
- assertTrue(moduleView instanceof ModuleView);
+ assertNotNull(moduleView);
assertTrue(moduleView.getClass() == TestModuleView.class);
ModuleController moduleController = viewFactory.createModuleController(new ModuleNode());
- assertTrue(moduleController instanceof ModuleController);
+ assertNotNull(moduleController);
assertTrue(moduleController.getClass() == TestModuleController.class);
ModuleGroupView moduleGroupView = viewFactory.createModuleGroupView(new Shell());
- assertTrue(moduleGroupView instanceof ModuleGroupView);
+ assertNotNull(moduleGroupView);
assertTrue(moduleGroupView.getClass() == TestModuleGroupView.class);
ModuleGroupController moduleGroupController = viewFactory.createModuleGroupController(new ModuleGroupNode());
- assertTrue(moduleGroupController instanceof ModuleGroupController);
+ assertNotNull(moduleGroupController);
assertTrue(moduleGroupController.getClass() == TestModuleGroupController.class);
this.removeExtension("org.eclipse.riena.test.navigationModuleView");
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleViewTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleViewTest.java
index 4d59d7f..89410f2 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleViewTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleViewTest.java
@@ -175,7 +175,7 @@ public class SubModuleViewTest extends RienaTestCase {
}
}
- private class TestComplexComponent extends Composite implements IComplexComponent {
+ private static class TestComplexComponent extends Composite implements IComplexComponent {
public TestComplexComponent(Composite parent, int style) {
super(parent, style);
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 5fe0faa..b2b909d 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
@@ -144,7 +144,12 @@ public abstract class RienaTestCase extends TestCase {
* @return
*/
protected File getFile(String resource) {
+ // TODO warning suppression. Ignoring FindBugs problem that
+ // getResource(..) will return a resource relative to a
+ // subclass rather than relative to this class. This is the
+ // intended behavior.
URL url = getClass().getResource(resource);
+ // nested File constructors for OS independence...
return new File(new File(new File("").getAbsolutePath(), "src"), url.getFile());
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/MaxNumberLengthTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/MaxNumberLengthTest.java
index fc13b84..0a8e410 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/MaxNumberLengthTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/MaxNumberLengthTest.java
@@ -13,8 +13,7 @@ package org.eclipse.riena.ui.ridgets.validation.tests;
import java.text.DecimalFormat;
import java.util.Locale;
-import junit.framework.TestCase;
-
+import org.eclipse.riena.tests.RienaTestCase;
import org.eclipse.riena.tests.TestUtils;
import org.eclipse.riena.tests.collect.NonUITestCase;
import org.eclipse.riena.ui.ridgets.validation.MaxNumberLength;
@@ -24,7 +23,7 @@ import org.eclipse.riena.ui.ridgets.validation.ValidationFailure;
* Tests for the MaxNumberLength rule.
*/
@NonUITestCase
-public class MaxNumberLengthTest extends TestCase {
+public class MaxNumberLengthTest extends RienaTestCase {
/**
* @throws Exception
@@ -38,7 +37,7 @@ public class MaxNumberLengthTest extends TestCase {
maxNumberLength.validate(new Object());
fail("expected thrown " + ValidationFailure.class.getName());
} catch (final ValidationFailure e) {
- assert true : "passed test";
+ ok("passed test");
} catch (final RuntimeException e) {
fail("expected thrown " + ValidationFailure.class.getName());
}
@@ -76,7 +75,7 @@ public class MaxNumberLengthTest extends TestCase {
maxNumberLength.validate(new Object());
fail("expected thrown " + ValidationFailure.class.getName());
} catch (final ValidationFailure e) {
- assert true : "passed test";
+ ok("passed test");
} catch (final RuntimeException e) {
fail("expected thrown " + ValidationFailure.class.getName());
}
@@ -111,7 +110,7 @@ public class MaxNumberLengthTest extends TestCase {
maxNumberLength.validate(new Object());
fail("expected thrown " + ValidationFailure.class.getName());
} catch (final ValidationFailure e) {
- assert true : "passed test";
+ ok("passed test");
} catch (final RuntimeException e) {
fail("expected thrown " + ValidationFailure.class.getName());
}
@@ -158,7 +157,7 @@ public class MaxNumberLengthTest extends TestCase {
maxNumberLength.validate(new Object());
fail("expected thrown " + ValidationFailure.class.getName());
} catch (final ValidationFailure e) {
- assert true : "passed test";
+ ok("passed test");
} catch (final RuntimeException e) {
fail("expected thrown " + ValidationFailure.class.getName());
}
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 d1ce601..6ccae1a 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
@@ -64,7 +64,7 @@ public class ValidDecimalTest extends RienaTestCase {
assertEquals(0.0d, DecimalFormat.getInstance(Locale.US).parse(".").doubleValue());
fail("expected a ParseException");
} catch (final ParseException e) {
- assert true : "test passed";
+ ok("passed test");
}
// last char is fraction digit
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidExpressionTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidExpressionTest.java
index 4ef20d8..b4fbb8c 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidExpressionTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidExpressionTest.java
@@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.riena.ui.ridgets.validation.tests;
-import junit.framework.TestCase;
-
import org.eclipse.core.runtime.IStatus;
+
+import org.eclipse.riena.tests.RienaTestCase;
import org.eclipse.riena.tests.collect.NonUITestCase;
import org.eclipse.riena.ui.ridgets.validation.IValidationRuleStatus;
import org.eclipse.riena.ui.ridgets.validation.ValidExpression;
@@ -22,7 +22,7 @@ import org.eclipse.riena.ui.ridgets.validation.ValidationFailure;
*
*/
@NonUITestCase
-public class ValidExpressionTest extends TestCase {
+public class ValidExpressionTest extends RienaTestCase {
public void testInvalidArgs() throws Exception {
try {
@@ -30,7 +30,7 @@ public class ValidExpressionTest extends TestCase {
rule.validate(new Object());
fail("expected a thrown " + ValidationFailure.class.getName());
} catch (ValidationFailure e) {
- assert true : "test passed";
+ ok("passed test");
} catch (RuntimeException e) {
fail("expected a thrown " + ValidationFailure.class.getName());
}
@@ -39,14 +39,14 @@ public class ValidExpressionTest extends TestCase {
new ValidExpression(null);
fail("Null expression: expected some kind of " + RuntimeException.class.getName());
} catch (RuntimeException e) {
- assert true : "test passed";
+ ok("passed test");
}
try {
new ValidExpression("");
fail("Empty expression: expected some kind of " + RuntimeException.class.getName());
} catch (RuntimeException e) {
- assert true : "test passed";
+ ok("passed test");
}
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidRangeTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidRangeTest.java
index 5f3daf5..9e52371 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidRangeTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidRangeTest.java
@@ -14,8 +14,7 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Locale;
-import junit.framework.TestCase;
-
+import org.eclipse.riena.tests.RienaTestCase;
import org.eclipse.riena.tests.TestUtils;
import org.eclipse.riena.tests.collect.NonUITestCase;
import org.eclipse.riena.ui.ridgets.validation.ValidRange;
@@ -24,7 +23,7 @@ import org.eclipse.riena.ui.ridgets.validation.ValidRange;
* Tests for the MaxLength rule.
*/
@NonUITestCase
-public class ValidRangeTest extends TestCase {
+public class ValidRangeTest extends RienaTestCase {
/**
* @throws Exception
@@ -151,45 +150,45 @@ public class ValidRangeTest extends TestCase {
new ValidRange((byte) 10, (short) 10);
fail("expected some RuntimeException");
} catch (final RuntimeException e) {
- assert true : "test passed";
+ ok("passed test");
}
try {
new ValidRange(10, 1000d);
fail("expected some RuntimeException");
} catch (final RuntimeException e) {
- assert true : "test passed";
+ ok("passed test");
}
// min greater max:
try {
new ValidRange(100, 10);
fail("expected some RuntimeException");
} catch (final RuntimeException e) {
- assert true : "test passed";
+ ok("passed test");
}
// null parameter
try {
new ValidRange(null, 10);
fail("expected some RuntimeException");
} catch (final RuntimeException e) {
- assert true : "test passed";
+ ok("passed test");
}
try {
new ValidRange(100, null);
fail("expected some RuntimeException");
} catch (final RuntimeException e) {
- assert true : "test passed";
+ ok("passed test");
}
try {
new ValidRange(null, null);
fail("expected some RuntimeException");
} catch (final RuntimeException e) {
- assert true : "test passed";
+ ok("passed test");
}
try {
new ValidRange(10, 100, null);
fail("expected some RuntimeException");
} catch (final RuntimeException e) {
- assert true : "test passed";
+ ok("passed test");
}
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidatorCollectionTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidatorCollectionTest.java
index 0266b72..d6c924c 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidatorCollectionTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/ridgets/validation/tests/ValidatorCollectionTest.java
@@ -12,6 +12,7 @@ package org.eclipse.riena.ui.ridgets.validation.tests;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.runtime.IStatus;
+
import org.eclipse.riena.tests.RienaTestCase;
import org.eclipse.riena.tests.collect.NonUITestCase;
import org.eclipse.riena.ui.ridgets.validation.ValidationFailure;
@@ -110,14 +111,14 @@ public class ValidatorCollectionTest extends RienaTestCase {
rule.iterator().remove();
fail("the returned iterator may not support the remove() method, modification through rule#remove(IValidator) only.");
} catch (final RuntimeException e) {
- assert true : "test passed";
+ ok("passed test");
}
try {
rule.getValidators().clear();
fail("the returned collection may not support the remove() method, modification through rule#remove(IValidator) only.");
} catch (final RuntimeException e) {
- assert true : "test passed";
+ ok("passed test");
}
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/swt/utils/SWTBindingPropertyLocatorTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/swt/utils/SWTBindingPropertyLocatorTest.java
index aac9189..4df796b 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/ui/swt/utils/SWTBindingPropertyLocatorTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/ui/swt/utils/SWTBindingPropertyLocatorTest.java
@@ -57,7 +57,7 @@ public class SWTBindingPropertyLocatorTest extends TestCase {
}
- private class TestComplexComponent extends Composite implements IComplexComponent {
+ private static class TestComplexComponent extends Composite implements IComplexComponent {
public TestComplexComponent(Composite parent, int style) {
super(parent, style);