Skip to content

Commit

Permalink
[Tests] Resolved critical build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
VWoeltjen committed Sep 23, 2013
1 parent 754e201 commit 38ebddc
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 12 deletions.
Expand Up @@ -101,7 +101,7 @@ public void run() {
maxControls.autoValue.setValue(getValue(minControls) + spanControls.getSpanValue());
}
} else {
maxControls.updateAuto((double) getValue(minControls) + spanControls.getSpanValue());
maxControls.updateAuto(getValue(minControls) + spanControls.getSpanValue());
}
}
};
Expand Down
Expand Up @@ -262,7 +262,6 @@ public void testExecute() {
Policy policy = new PlotViewPolicy();
PolicyContext context;

ViewInfo otherViewInfo = new ViewInfo(NonPlotView.class, "NonPlot", ViewType.OBJECT);
ViewInfo plotViewInfo = new ViewInfo(PlotViewManifestation.class, "Plot", ViewType.OBJECT);

// Plot views should be allowed for leaf component with a feed
Expand Down Expand Up @@ -295,7 +294,10 @@ public void testExecute() {
}
}

private static class NonPlotView extends View {
private static class NonPlotView extends View {
private static final long serialVersionUID = 3389103274105732666L;

@SuppressWarnings("unused") // Constructor needed to satisfy Viewinfo
public NonPlotView(AbstractComponent ac, ViewInfo vi) {
super(ac,vi);
}
Expand Down
Expand Up @@ -30,12 +30,8 @@ public class TestPlotSettingsAxisGroup {
private static final int SETTINGS_MAX = 100;
private static final int PLOT_MIN = -50;
private static final int PLOT_MAX = 50;
private static final int OTHER_MIN = -25;
private static final int OTHER_MAX = 25;
private static final int SPAN = 33;

private static final long SETTINGS_MIN_TIME = 1000;
private static final long SETTINGS_MAX_TIME = 31000;

private static final long PLOT_MIN_TIME = 1000;
private static final long PLOT_MAX_TIME = 31000;
Expand Down Expand Up @@ -151,6 +147,7 @@ public void testGetSetTitle() {
}

public static class PlotSettingsAxisGroupTester extends PlotSettingsAxisGroup {
private static final long serialVersionUID = -7947400808583335533L;
private boolean temporal;

public PlotSettingsAxisGroupTester(boolean temporal) {
Expand Down
Expand Up @@ -74,6 +74,7 @@ public void testValidAndDirtyFlags() {
}

private static class Tester extends PlotSettingsCheckBox {
private static final long serialVersionUID = 1019496761275527323L;

public Tester() {
super("Tester");
Expand Down
Expand Up @@ -31,7 +31,8 @@ public void setup() {
@Test
public void testHardAndSoftReset() {
for (Object[] choices : new Object[][]{STRING_CHOICES, INTEGER_CHOICES}) {
for (int i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++) {
@SuppressWarnings({ "rawtypes", "unchecked" })
Tester<?> t = new Tester(choices, choices[i].getClass());

if (choices[i] instanceof Integer) {
Expand Down Expand Up @@ -65,6 +66,7 @@ public void testHardAndSoftReset() {
public void testPopulate() {
for (Object[] choices : new Object[][]{STRING_CHOICES, INTEGER_CHOICES}) {
for (int i = 0; i < 3; i++) {
@SuppressWarnings({ "rawtypes", "unchecked" })
Tester<?> t = new Tester(choices, choices[i].getClass());

if (choices[i] instanceof Integer) {
Expand All @@ -90,7 +92,8 @@ public void testPopulate() {
@Test
public void testDirty() {
for (Object[] choices : new Object[][]{STRING_CHOICES, INTEGER_CHOICES}) {
for (int i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++) {
@SuppressWarnings({ "rawtypes", "unchecked" })
Tester<?> t = new Tester(choices, choices[i].getClass());

if (choices[i] instanceof Integer) {
Expand Down Expand Up @@ -131,6 +134,7 @@ public void testDirty() {

@Test
public void testSetText() {
@SuppressWarnings({ "rawtypes", "unchecked" })
Tester<Integer> t = new Tester(INTEGER_CHOICES, Integer.class);

// Find a combo box to test with
Expand Down Expand Up @@ -161,13 +165,18 @@ public void testSetText() {
}

private static class Tester<T> extends PlotSettingsComboBox<T> {
/**
*
*/
private static final long serialVersionUID = -9214443775684345868L;
private Class<T> c;

public Tester (T[] choices, Class<T> cls) {
super(choices);
c = cls;
}

@SuppressWarnings("unchecked")
public void setSelection(Object object) {
super.setSelection((T) object);
}
Expand All @@ -181,6 +190,7 @@ public void populate(PlotConfiguration settings) {
}
}

@SuppressWarnings("unchecked")
@Override
public void reset(PlotConfiguration settings, boolean hard) {
if (hard) setSelection((T) (Integer.class.isAssignableFrom(c) ?
Expand Down
Expand Up @@ -29,7 +29,8 @@ public void setup() {
@Test
public void testHardAndSoftReset() {
for (Object[] choices : new Object[][]{STRING_CHOICES, INTEGER_CHOICES}) {
for (int i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++) {
@SuppressWarnings({ "rawtypes", "unchecked" })
Tester<?> t = new Tester(choices, choices[i].getClass());

if (choices[i] instanceof Integer) {
Expand Down Expand Up @@ -62,7 +63,8 @@ public void testHardAndSoftReset() {
@Test
public void testPopulate() {
for (Object[] choices : new Object[][]{STRING_CHOICES, INTEGER_CHOICES}) {
for (int i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++) {
@SuppressWarnings({ "rawtypes", "unchecked" })
Tester<?> t = new Tester(choices, choices[i].getClass());

if (choices[i] instanceof Integer) {
Expand All @@ -88,7 +90,8 @@ public void testPopulate() {
@Test
public void testDirty() {
for (Object[] choices : new Object[][]{STRING_CHOICES, INTEGER_CHOICES}) {
for (int i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++) {
@SuppressWarnings({ "rawtypes", "unchecked" })
Tester<?> t = new Tester(choices, choices[i].getClass());

if (choices[i] instanceof Integer) {
Expand Down Expand Up @@ -129,6 +132,7 @@ public void testDirty() {

@Test
public void testSetText() {
@SuppressWarnings({ "rawtypes", "unchecked" })
Tester<Integer> t = new Tester(INTEGER_CHOICES, Integer.class);

// By default, should appear as toString
Expand All @@ -150,17 +154,20 @@ public void testSetText() {
}

private static class Tester<T> extends PlotSettingsRadioButtonGroup<T> {
private static final long serialVersionUID = 2491883458409785019L;
private Class<T> c;

public Tester (T[] choices, Class<T> cls) {
super(choices);
c = cls;
}

@SuppressWarnings("unchecked")
public JRadioButton getButton(Object object) {
return super.getButton((T) object);
}

@SuppressWarnings("unchecked")
public void setSelection(Object object) {
super.setSelection((T) object);
}
Expand All @@ -174,6 +181,7 @@ public void populate(PlotConfiguration settings) {
}
}

@SuppressWarnings("unchecked")
@Override
public void reset(PlotConfiguration settings, boolean hard) {
if (hard) setSelection((T) (Integer.class.isAssignableFrom(c) ?
Expand Down

0 comments on commit 38ebddc

Please sign in to comment.