use of com.chrisali.javaflightsim.swing.plotting.PlotConfiguration.SubPlotBundle in project j6dof-flight-sim by chris-ali.
the class ReadWriteJsonTest method WriteThenReadPlotConfigurationTest.
@Test
public void WriteThenReadPlotConfigurationTest() {
PlotConfiguration plots = FileUtilities.readPlotConfiguration();
String assertion = "Deserialized property should not be null";
assertNotNull(assertion, plots);
assertNotNull(assertion, plots.getSubPlotBundles());
assertTrue("There should be at least one bundle in configuration", plots.getSubPlotBundles().size() > 0);
for (Map.Entry<String, SubPlotBundle> entry : plots.getSubPlotBundles().entrySet()) {
SubPlotBundle bundle = entry.getValue();
assertNotNull(assertion, bundle);
assertNotNull(assertion, bundle.getSizeXPixels());
assertNotNull(assertion, bundle.getSizeYPixels());
assertNotNull(assertion, bundle.getTitle());
assertNotNull(assertion, bundle.getSubPlots());
assertTrue("There should be at least one subplot in this bundle", bundle.getSubPlots().size() > 0);
for (SubPlotOptions subplot : bundle.getSubPlots()) {
assertNotNull(assertion, subplot);
assertNotNull(assertion, subplot.getTitle());
assertNotNull(assertion, subplot.getxAxisName());
assertNotNull(assertion, subplot.getyAxisName());
assertNotNull(assertion, subplot.getxData());
assertNotNull(assertion, subplot.getyData());
assertTrue("There should be at least one y data in this bundle", subplot.getyData().size() > 0);
for (SimOuts simout : subplot.getyData()) {
assertNotNull(assertion, simout);
}
}
}
plots.save();
PlotConfiguration readPlots = FileUtilities.readPlotConfiguration();
assertion = "Deserialized property should not be null";
assertNotNull(assertion, readPlots);
assertNotNull(assertion, readPlots.getSubPlotBundles());
assertTrue("There should be at least one bundle in configuration", readPlots.getSubPlotBundles().size() > 0);
for (Map.Entry<String, SubPlotBundle> entry : readPlots.getSubPlotBundles().entrySet()) {
SubPlotBundle bundle = entry.getValue();
assertNotNull(assertion, bundle);
assertNotNull(assertion, bundle.getSizeXPixels());
assertNotNull(assertion, bundle.getSizeYPixels());
assertNotNull(assertion, bundle.getTitle());
assertNotNull(assertion, bundle.getSubPlots());
assertTrue("There should be at least one subplot in this bundle", bundle.getSubPlots().size() > 0);
for (SubPlotOptions subplot : bundle.getSubPlots()) {
assertNotNull(assertion, subplot);
assertNotNull(assertion, subplot.getTitle());
assertNotNull(assertion, subplot.getxAxisName());
assertNotNull(assertion, subplot.getyAxisName());
assertNotNull(assertion, subplot.getxData());
assertNotNull(assertion, subplot.getyData());
assertTrue("There should be at least one y data in this bundle", subplot.getyData().size() > 0);
for (SimOuts simout : subplot.getyData()) {
assertNotNull(assertion, simout);
}
}
}
}
Aggregations