DGP - Modified Rocksim import to discriminate between centering ring, tube coupler...
authorrodinia814 <rodinia814@180e2498-e6e9-4542-8430-84ac67f01cd8>
Wed, 4 Jan 2012 14:18:24 +0000 (14:18 +0000)
committerrodinia814 <rodinia814@180e2498-e6e9-4542-8430-84ac67f01cd8>
Wed, 4 Jan 2012 14:18:24 +0000 (14:18 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@272 180e2498-e6e9-4542-8430-84ac67f01cd8

16 files changed:
src/net/sf/openrocket/file/rocksim/BaseHandler.java
src/net/sf/openrocket/file/rocksim/PositionDependentHandler.java
src/net/sf/openrocket/file/rocksim/RingHandler.java
test/net/sf/openrocket/file/rocksim/BodyTubeHandlerTest.java
test/net/sf/openrocket/file/rocksim/FinSetHandlerTest.java
test/net/sf/openrocket/file/rocksim/InnerBodyTubeHandlerTest.java
test/net/sf/openrocket/file/rocksim/LaunchLugHandlerTest.java
test/net/sf/openrocket/file/rocksim/MassObjectHandlerTest.java
test/net/sf/openrocket/file/rocksim/NoseConeHandlerTest.java
test/net/sf/openrocket/file/rocksim/ParachuteHandlerTest.java
test/net/sf/openrocket/file/rocksim/RingHandlerTest.java
test/net/sf/openrocket/file/rocksim/RocksimContentHandlerTest.java
test/net/sf/openrocket/file/rocksim/RocksimLoaderTest.java
test/net/sf/openrocket/file/rocksim/RocksimTestBase.java
test/net/sf/openrocket/file/rocksim/StreamerHandlerTest.java
test/net/sf/openrocket/file/rocksim/TransitionHandlerTest.java

index c4e9c11e403efadd9d9cbf6fe1f4526b33587d1c..0f648ebab8f5a15529e09a9f744a11325bf6af57 100644 (file)
@@ -201,11 +201,12 @@ public abstract class BaseHandler<C extends RocketComponent> extends ElementHand
     }
     
     /**
-     * Create a custom material based on the density.
+     * Create a custom material based on the density.  The name of the material is prepended with 'RS: ' to
+     * indicate it came from a RockSim material.
      *
      * @param type    the type of the material
      * @param name    the name of the component
-     * @param density the density in g/cm^3
+     * @param density the density
      *
      * @return a Material instance
      */
index c65e1aec9b79007e8014694021f97897cd0e9719..076f46a70e424f54223756cdf3fc861f08334164 100644 (file)
@@ -18,10 +18,10 @@ import java.util.HashMap;
 public abstract class PositionDependentHandler<C extends RocketComponent> extends BaseHandler<C> {
 
     /** Temporary position value. */
-    private Double positionValue;
+    private Double positionValue = 0d;
 
     /** Temporary position. */
-    private RocketComponent.Position position;
+    private RocketComponent.Position position = RocketComponent.Position.TOP;
 
     /**
      * {@inheritDoc}
index 22394201bda21032c66bf560c4b4d8f43014886d..e3d6134bd5470cca4442fa2b43e195cf536e12a7 100644 (file)
@@ -7,37 +7,48 @@ import net.sf.openrocket.aerodynamics.WarningSet;
 import net.sf.openrocket.file.simplesax.ElementHandler;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
+import net.sf.openrocket.rocketcomponent.Bulkhead;
 import net.sf.openrocket.rocketcomponent.CenteringRing;
+import net.sf.openrocket.rocketcomponent.EngineBlock;
+import net.sf.openrocket.rocketcomponent.RingComponent;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
+import net.sf.openrocket.rocketcomponent.TubeCoupler;
 import org.xml.sax.SAXException;
 
 import java.util.HashMap;
 
 /**
- * A SAX handler for centering rings and bulkheads.
+ * A SAX handler for centering rings, tube couplers, and bulkheads.
  */
 class RingHandler extends PositionDependentHandler<CenteringRing> {
 
     /**
      * The OpenRocket Ring.
      */
-    private final CenteringRing ring;
+    private final CenteringRing ring = new CenteringRing();
+
+    /**
+     * The parent component.
+     */
+    private final RocketComponent parent;
+
+    /**
+     * The parsed Rocksim UsageCode.
+     */
+    private int usageCode = 0;
 
     /**
      * Constructor.
      *
-     * @param c the parent component
+     * @param theParent the parent component
      * @param warnings  the warning set
      * @throws IllegalArgumentException thrown if <code>c</code> is null
      */
-    public RingHandler(RocketComponent c, WarningSet warnings) throws IllegalArgumentException {
-        if (c == null) {
+    public RingHandler(RocketComponent theParent, WarningSet warnings) throws IllegalArgumentException {
+        if (theParent == null) {
             throw new IllegalArgumentException("The parent of a ring may not be null.");
         }
-        ring = new CenteringRing();
-        if (isCompatible(c, CenteringRing.class, warnings)) {
-            c.addChild(ring);
-        }
+        parent = theParent;
     }
 
     @Override
@@ -63,15 +74,17 @@ class RingHandler extends PositionDependentHandler<CenteringRing> {
             if ("Material".equals(element)) {
                 setMaterialName(content);
             }
-        }
-        catch (NumberFormatException nfe) {
+            if ("UsageCode".equals(element)) {
+                usageCode = Integer.parseInt(content);
+            }
+        } catch (NumberFormatException nfe) {
             warnings.add("Could not convert " + element + " value of " + content + ".  It is expected to be a number.");
         }
     }
 
     /**
      * Get the ring component this handler is working upon.
-     * 
+     *
      * @return a component
      */
     @Override
@@ -80,16 +93,133 @@ class RingHandler extends PositionDependentHandler<CenteringRing> {
     }
 
     /**
-     * Set the relative position onto the component.  This cannot be done directly because setRelativePosition is not 
+     * This method adds the CenteringRing as a child of the parent rocket component.
+     *
+     * @param warnings the warning set
+     */
+    public void asCenteringRing(WarningSet warnings) {
+
+        if (isCompatible(parent, CenteringRing.class, warnings)) {
+            parent.addChild(ring);
+        }
+    }
+
+    /**
+     * Convert the parsed Rocksim data values in this object to an instance of OpenRocket's Bulkhead.
+     * <p/>
+     * Side Effect Warning: This method adds the resulting Bulkhead as a child of the parent rocket component!
+     *
+     * @param warnings the warning set
+     */
+    public void asBulkhead(WarningSet warnings) {
+
+        Bulkhead result = new Bulkhead();
+
+        copyValues(result);
+
+        if (isCompatible(parent, Bulkhead.class, warnings)) {
+            parent.addChild(result);
+        }
+    }
+
+    /**
+     * Convert the parsed Rocksim data values in this object to an instance of OpenRocket's TubeCoupler.
+     * <p/>
+     * Side Effect Warning: This method adds the resulting TubeCoupler as a child of the parent rocket component!
+     *
+     * @param warnings the warning set
+     */
+    public void asTubeCoupler(WarningSet warnings) {
+
+        TubeCoupler result = new TubeCoupler();
+
+        copyValues(result);
+
+        if (isCompatible(parent, TubeCoupler.class, warnings)) {
+            parent.addChild(result);
+        }
+    }
+
+    /**
+     * Convert the parsed Rocksim data values in this object to an instance of OpenRocket's Engine Block.
+     * <p/>
+     * Side Effect Warning: This method adds the resulting EngineBlock as a child of the parent rocket component!
+     *
+     * @param warnings the warning set
+     */
+    public void asEngineBlock(WarningSet warnings) {
+
+        EngineBlock result = new EngineBlock();
+
+        copyValues(result);
+
+        if (isCompatible(parent, EngineBlock.class, warnings)) {
+            parent.addChild(result);
+        }
+    }
+
+    /**
+     * Copy values from the base ring to the specific component.
+     *
+     * @param result the target to which ring values will be copied
+     */
+    private void copyValues(RingComponent result) {
+        result.setOuterRadius(ring.getOuterRadius());
+        result.setInnerRadius(ring.getInnerRadius());
+        result.setLength(ring.getLength());
+        result.setName(ring.getName());
+        PositionDependentHandler.setOverride(result, ring.isOverrideSubcomponentsEnabled(), ring.getOverrideMass(), ring.getOverrideCGX());
+        result.setRelativePosition(ring.getRelativePosition());
+        result.setPositionValue(ring.getPositionValue());
+        result.setMaterial(ring.getMaterial());
+    }
+
+    /**
+     * Set the relative position onto the component.  This cannot be done directly because setRelativePosition is not
      * public in all components.
-     * 
-     * @param position  the OpenRocket position
+     *
+     * @param position the OpenRocket position
      */
     @Override
     public void setRelativePosition(RocketComponent.Position position) {
         ring.setRelativePosition(position);
     }
 
+    @Override
+    public void endHandler(String element, HashMap<String, String> attributes, String content, WarningSet warnings) throws SAXException {
+        super.endHandler(element, attributes, content, warnings);
+
+        // The <Ring> XML element in Rocksim design file is used for many types of components, unfortunately.
+        // Additional subelements are used to indicate the type of the rocket component. When parsing using SAX
+        // this poses a problem because we can't "look ahead" to see what type is being represented at the start
+        // of parsing - something that would be nice to do so that we can instantiate the correct OR component
+        // at the start, then just call setters for the appropriate data.
+
+        // To overcome that, a CenteringRing is instantiated at the start of parsing, it's mutators are called,
+        // and then at the end (this method) converts the CenteringRing to a more appropriate type.  CenteringRing
+        // is generic enough to support the representation of all similar types without loss of data.
+
+        //UsageCode
+        // 0 == Centering Ring
+        // 1 == Bulkhead
+        // 2 == Engine Block
+        // 3 == Sleeve
+        // 4 == Tube Coupler
+
+        if (usageCode == 1) {
+            //Bulkhead
+            asBulkhead(warnings);
+        } else if (usageCode == 2) {
+            asEngineBlock(warnings);
+        } else if (usageCode == 4) {
+            //TubeCoupler
+            asTubeCoupler(warnings);
+        } else {
+            //Default
+            asCenteringRing(warnings);
+        }
+    }
+
     /**
      * Get the required type of material for this component.
      *
@@ -99,5 +229,4 @@ class RingHandler extends PositionDependentHandler<CenteringRing> {
     public Material.Type getMaterialType() {
         return Material.Type.BULK;
     }
-}
-
+}
\ No newline at end of file
index 8cbd6f783171ba56848c0aa78678991e09bef9f8..88a7892a658d7c831a9ec57a1d4ffff43b031ffa 100644 (file)
@@ -3,14 +3,14 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import net.sf.openrocket.aerodynamics.WarningSet;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.BodyTube;
 import net.sf.openrocket.rocketcomponent.ExternalComponent;
 import net.sf.openrocket.rocketcomponent.Stage;
+import org.junit.Assert;
+import org.junit.Test;
 
 import java.util.HashMap;
 
@@ -20,59 +20,17 @@ import java.util.HashMap;
  */
 public class BodyTubeHandlerTest extends RocksimTestBase {
 
-    /**
-     * The class under test.
-     */
-    public static final Class classUT = BodyTubeHandler.class;
-
-    /**
-     * The test class (this class).
-     */
-    public static final Class testClass = BodyTubeHandlerTest.class;
-
-    /**
-     * Create a test suite of all tests within this test class.
-     *
-     * @return a suite of tests
-     */
-    public static Test suite() {
-        return new TestSuite(BodyTubeHandlerTest.class);
-    }
-
-    /**
-     * Test constructor.
-     *
-     * @param name the name of the test to run.
-     */
-    public BodyTubeHandlerTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Setup the fixture.
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Teardown the fixture.
-     */
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-
     /**
      * Method: constructor
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testConstructor() throws Exception {
 
         try {
             new BodyTubeHandler(null, new WarningSet());
-            fail("Should have thrown IllegalArgumentException");
+            Assert.fail("Should have thrown IllegalArgumentException");
         }
         catch (IllegalArgumentException iae) {
             //success
@@ -89,9 +47,10 @@ public class BodyTubeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testOpenElement() throws Exception {
-        assertEquals(PlainTextHandler.INSTANCE, new BodyTubeHandler(new Stage(), new WarningSet()).openElement(null, null, null));
-        assertNotNull(new BodyTubeHandler(new Stage(), new WarningSet()).openElement("AttachedParts", null, null));
+        Assert.assertEquals(PlainTextHandler.INSTANCE, new BodyTubeHandler(new Stage(), new WarningSet()).openElement(null, null, null));
+        Assert.assertNotNull(new BodyTubeHandler(new Stage(), new WarningSet()).openElement("AttachedParts", null, null));
     }
 
     /**
@@ -100,6 +59,7 @@ public class BodyTubeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception  thrown if something goes awry
      */
+    @Test
     public void testCloseElement() throws Exception {
         Stage stage = new Stage();
         BodyTubeHandler handler = new BodyTubeHandler(stage, new WarningSet());
@@ -108,62 +68,62 @@ public class BodyTubeHandlerTest extends RocksimTestBase {
         WarningSet warnings = new WarningSet();
 
         handler.closeElement("OD", attributes, "-1", warnings);
-        assertEquals(0d, component.getInnerRadius());
+        Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("OD", attributes, "0", warnings);
-        assertEquals(0d, component.getInnerRadius());
+        Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("OD", attributes, "75", warnings);
-        assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius());
+        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
         handler.closeElement("OD", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("ID", attributes, "-1", warnings);
-        assertEquals(0d, component.getInnerRadius());
+        Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "0", warnings);
-        assertEquals(0d, component.getInnerRadius());
+        Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "75", warnings);
-        assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius());
+        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Len", attributes, "-1", warnings);
-        assertEquals(0d, component.getLength());
+        Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("IsMotorMount", attributes, "1", warnings);
-        assertTrue(component.isMotorMount());
+        Assert.assertTrue(component.isMotorMount());
         handler.closeElement("IsMotorMount", attributes, "0", warnings);
-        assertFalse(component.isMotorMount());
+        Assert.assertFalse(component.isMotorMount());
         handler.closeElement("IsMotorMount", attributes, "foo", warnings);
-        assertFalse(component.isMotorMount());
+        Assert.assertFalse(component.isMotorMount());
 
         handler.closeElement("EngineOverhang", attributes, "-1", warnings);
-        assertEquals(-1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang());
+        Assert.assertEquals(-1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
         handler.closeElement("EngineOverhang", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
         handler.closeElement("EngineOverhang", attributes, "10.0", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
         handler.closeElement("EngineOverhang", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("FinishCode", attributes, "-1", warnings);
-        assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
+        Assert.assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
         handler.closeElement("FinishCode", attributes, "100", warnings);
-        assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
+        Assert.assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
         handler.closeElement("FinishCode", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Name", attributes, "Test Name", warnings);
-        assertEquals("Test Name", component.getName());
+        Assert.assertEquals("Test Name", component.getName());
     }
     
     /**
@@ -171,8 +131,9 @@ public class BodyTubeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testGetComponent() throws Exception {
-        assertTrue(new BodyTubeHandler(new Stage(), new WarningSet()).getComponent() instanceof BodyTube);
+        Assert.assertTrue(new BodyTubeHandler(new Stage(), new WarningSet()).getComponent() instanceof BodyTube);
     }
 
     /**
@@ -180,8 +141,9 @@ public class BodyTubeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testGetMaterialType() throws Exception {
-        assertEquals(Material.Type.BULK, new BodyTubeHandler(new Stage(), new WarningSet()).getMaterialType());
+        Assert.assertEquals(Material.Type.BULK, new BodyTubeHandler(new Stage(), new WarningSet()).getMaterialType());
     }
 
 }
index 1cc4792edda5d4bf13f15415f1ca5b87ea8b5058..4ee683e83c380619c487347320fc18c25d20d4b0 100644 (file)
@@ -3,9 +3,7 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import junit.framework.Test;
 import junit.framework.TestCase;
-import junit.framework.TestSuite;
 import net.sf.openrocket.aerodynamics.WarningSet;
 import net.sf.openrocket.rocketcomponent.BodyTube;
 import net.sf.openrocket.rocketcomponent.EllipticalFinSet;
@@ -22,54 +20,12 @@ import java.util.HashMap;
  */
 public class FinSetHandlerTest extends TestCase {
 
-    /**
-     * The class under test.
-     */
-    public static final Class classUT = FinSetHandler.class;
-
-    /**
-     * The test class (this class).
-     */
-    public static final Class testClass = FinSetHandlerTest.class;
-
-    /**
-     * Create a test suite of all tests within this test class.
-     *
-     * @return a suite of tests
-     */
-    public static Test suite() {
-        return new TestSuite(FinSetHandlerTest.class);
-    }
-
-    /**
-     * Test constructor.
-     *
-     * @param name the name of the test to run.
-     */
-    public FinSetHandlerTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Setup the fixture.
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Teardown the fixture.
-     */
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-
     /**
      * Method: asOpenRocket(WarningSet warnings)
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testAsOpenRocket() throws Exception {
 
         FinSetHandler dto = new FinSetHandler(new BodyTube());
@@ -135,6 +91,7 @@ public class FinSetHandlerTest extends TestCase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testToCoordinates() throws Exception {
         FinSetHandler holder = new FinSetHandler(new BodyTube());
         Method method = FinSetHandler.class.getDeclaredMethod("toCoordinates", String.class, WarningSet.class);
index d8d892c695125e7490f30331452cdbb93490b90c..d1950bc8dac320893c9c439f74ab0ee9d7fee10b 100644 (file)
@@ -3,14 +3,13 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import net.sf.openrocket.aerodynamics.WarningSet;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.BodyTube;
 import net.sf.openrocket.rocketcomponent.InnerTube;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
+import org.junit.Assert;
 
 import java.util.HashMap;
 
@@ -20,59 +19,17 @@ import java.util.HashMap;
  */
 public class InnerBodyTubeHandlerTest extends RocksimTestBase {
 
-    /**
-     * The class under test.
-     */
-    public static final Class classUT = InnerBodyTubeHandler.class;
-
-    /**
-     * The test class (this class).
-     */
-    public static final Class testClass = InnerBodyTubeHandlerTest.class;
-
-    /**
-     * Create a test suite of all tests within this test class.
-     *
-     * @return a suite of tests
-     */
-    public static Test suite() {
-        return new TestSuite(InnerBodyTubeHandlerTest.class);
-    }
-
-    /**
-     * Test constructor.
-     *
-     * @param name the name of the test to run.
-     */
-    public InnerBodyTubeHandlerTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Setup the fixture.
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Teardown the fixture.
-     */
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-
     /**
      * Method: constructor
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testConstructor() throws Exception {
 
         try {
             new InnerBodyTubeHandler(null, new WarningSet());
-            fail("Should have thrown IllegalArgumentException");
+            Assert.fail("Should have thrown IllegalArgumentException");
         }
         catch (IllegalArgumentException iae) {
             //success
@@ -89,9 +46,10 @@ public class InnerBodyTubeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testOpenElement() throws Exception {
-        assertEquals(PlainTextHandler.INSTANCE, new InnerBodyTubeHandler(new BodyTube(), new WarningSet()).openElement(null, null, null));
-        assertNotNull(new InnerBodyTubeHandler(new BodyTube(), new WarningSet()).openElement("AttachedParts", null, null));
+        Assert.assertEquals(PlainTextHandler.INSTANCE, new InnerBodyTubeHandler(new BodyTube(), new WarningSet()).openElement(null, null, null));
+        Assert.assertNotNull(new InnerBodyTubeHandler(new BodyTube(), new WarningSet()).openElement("AttachedParts", null, null));
     }
 
     /**
@@ -100,6 +58,7 @@ public class InnerBodyTubeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception  thrown if something goes awry
      */
+    @org.junit.Test
     public void testCloseElement() throws Exception {
         BodyTube tube = new BodyTube();
         InnerBodyTubeHandler handler = new InnerBodyTubeHandler(tube, new WarningSet());
@@ -108,54 +67,54 @@ public class InnerBodyTubeHandlerTest extends RocksimTestBase {
         WarningSet warnings = new WarningSet();
 
         handler.closeElement("OD", attributes, "-1", warnings);
-        assertEquals(0d, component.getInnerRadius());
+        Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("OD", attributes, "0", warnings);
-        assertEquals(0d, component.getInnerRadius());
+        Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("OD", attributes, "75", warnings);
-        assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius());
+        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
         handler.closeElement("OD", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("ID", attributes, "-1", warnings);
-        assertEquals(0d, component.getInnerRadius());
+        Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "0", warnings);
-        assertEquals(0d, component.getInnerRadius());
+        Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "75", warnings);
-        assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius());
+        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Len", attributes, "-1", warnings);
-        assertEquals(0d, component.getLength());
+        Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("IsMotorMount", attributes, "1", warnings);
-        assertTrue(component.isMotorMount());
+        Assert.assertTrue(component.isMotorMount());
         handler.closeElement("IsMotorMount", attributes, "0", warnings);
-        assertFalse(component.isMotorMount());
+        Assert.assertFalse(component.isMotorMount());
         handler.closeElement("IsMotorMount", attributes, "foo", warnings);
-        assertFalse(component.isMotorMount());
+        Assert.assertFalse(component.isMotorMount());
 
         handler.closeElement("EngineOverhang", attributes, "-1", warnings);
-        assertEquals(-1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang());
+        Assert.assertEquals(-1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
         handler.closeElement("EngineOverhang", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
         handler.closeElement("EngineOverhang", attributes, "10.0", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getMotorOverhang(), 0.001);
         handler.closeElement("EngineOverhang", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Name", attributes, "Test Name", warnings);
-        assertEquals("Test Name", component.getName());
+        Assert.assertEquals("Test Name", component.getName());
     }
     
     /**
@@ -163,12 +122,13 @@ public class InnerBodyTubeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testSetRelativePosition() throws Exception {
         BodyTube tube = new BodyTube();
         InnerBodyTubeHandler handler = new InnerBodyTubeHandler(tube, new WarningSet());
         InnerTube component = (InnerTube) getField(handler, "bodyTube");
         handler.setRelativePosition(RocketComponent.Position.ABSOLUTE);
-        assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
+        Assert.assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
     }
 
     /**
@@ -176,8 +136,9 @@ public class InnerBodyTubeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetComponent() throws Exception {
-        assertTrue(new InnerBodyTubeHandler(new BodyTube(), new WarningSet()).getComponent() instanceof InnerTube);
+        Assert.assertTrue(new InnerBodyTubeHandler(new BodyTube(), new WarningSet()).getComponent() instanceof InnerTube);
     }
 
     /**
@@ -185,11 +146,9 @@ public class InnerBodyTubeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetMaterialType() throws Exception {
-        assertEquals(Material.Type.BULK, new InnerBodyTubeHandler(new BodyTube(), new WarningSet()).getMaterialType());
+        Assert.assertEquals(Material.Type.BULK, new InnerBodyTubeHandler(new BodyTube(), new WarningSet()).getMaterialType());
     }
 
-
-
-
 }
index 9c6a48b973d0b51355dfe2c0d6c52293a28c8e6e..0effbeaa88e24d434b8cfcac8af535b4d8f858d0 100644 (file)
@@ -3,8 +3,6 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import net.sf.openrocket.aerodynamics.WarningSet;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
@@ -12,6 +10,7 @@ import net.sf.openrocket.rocketcomponent.BodyTube;
 import net.sf.openrocket.rocketcomponent.ExternalComponent;
 import net.sf.openrocket.rocketcomponent.LaunchLug;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
+import org.junit.Assert;
 
 import java.util.HashMap;
 
@@ -21,58 +20,17 @@ import java.util.HashMap;
  */
 public class LaunchLugHandlerTest extends RocksimTestBase {
 
-    /**
-     * The class under test.
-     */
-    public static final Class classUT = LaunchLugHandler.class;
-
-    /**
-     * The test class (this class).
-     */
-    public static final Class testClass = LaunchLugHandlerTest.class;
-
-    /**
-     * Create a test suite of all tests within this test class.
-     *
-     * @return a suite of tests
-     */
-    public static Test suite() {
-        return new TestSuite(LaunchLugHandlerTest.class);
-    }
-
-    /**
-     * Test constructor.
-     *
-     * @param name the name of the test to run.
-     */
-    public LaunchLugHandlerTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Setup the fixture.
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Teardown the fixture.
-     */
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
     /**
      * Method: constructor
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testConstructor() throws Exception {
 
         try {
             new LaunchLugHandler(null, new WarningSet());
-            fail("Should have thrown IllegalArgumentException");
+            Assert.fail("Should have thrown IllegalArgumentException");
         }
         catch (IllegalArgumentException iae) {
             //success
@@ -89,8 +47,9 @@ public class LaunchLugHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testOpenElement() throws Exception {
-        assertEquals(PlainTextHandler.INSTANCE, new LaunchLugHandler(new BodyTube(), new WarningSet()).openElement(null, null, null));
+        Assert.assertEquals(PlainTextHandler.INSTANCE, new LaunchLugHandler(new BodyTube(), new WarningSet()).openElement(null, null, null));
     }
 
     /**
@@ -99,6 +58,7 @@ public class LaunchLugHandlerTest extends RocksimTestBase {
      *
      * @throws Exception  thrown if something goes awry
      */
+    @org.junit.Test
     public void testCloseElement() throws Exception {
         BodyTube tube = new BodyTube();
         LaunchLugHandler handler = new LaunchLugHandler(tube, new WarningSet());
@@ -107,45 +67,45 @@ public class LaunchLugHandlerTest extends RocksimTestBase {
         WarningSet warnings = new WarningSet();
 
         handler.closeElement("OD", attributes, "-1", warnings);
-        assertEquals(0d, component.getOuterRadius());
+        Assert.assertEquals(0d, component.getOuterRadius(), 0.001);
         handler.closeElement("OD", attributes, "0", warnings);
-        assertEquals(0d, component.getOuterRadius());
+        Assert.assertEquals(0d, component.getOuterRadius(), 0.001);
         handler.closeElement("OD", attributes, "75", warnings);
-        assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getOuterRadius());
+        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getOuterRadius(), 0.001);
         handler.closeElement("OD", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("ID", attributes, "-1", warnings);
-        assertEquals(0d, component.getInnerRadius());
+        Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "0", warnings);
-        assertEquals(0d, component.getInnerRadius());
+        Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "75", warnings);
-        assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius());
+        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Len", attributes, "-1", warnings);
-        assertEquals(0d, component.getLength());
+        Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("FinishCode", attributes, "-1", warnings);
-        assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
+        Assert.assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
         handler.closeElement("FinishCode", attributes, "100", warnings);
-        assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
+        Assert.assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
         handler.closeElement("FinishCode", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Name", attributes, "Test Name", warnings);
-        assertEquals("Test Name", component.getName());
+        Assert.assertEquals("Test Name", component.getName());
     }
     
     /**
@@ -153,12 +113,13 @@ public class LaunchLugHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testSetRelativePosition() throws Exception {
         BodyTube tube = new BodyTube();
         LaunchLugHandler handler = new LaunchLugHandler(tube, new WarningSet());
         LaunchLug component = (LaunchLug) getField(handler, "lug");
         handler.setRelativePosition(RocketComponent.Position.ABSOLUTE);
-        assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
+        Assert.assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
     }
 
     /**
@@ -166,8 +127,9 @@ public class LaunchLugHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetComponent() throws Exception {
-        assertTrue(new LaunchLugHandler(new BodyTube(), new WarningSet()).getComponent() instanceof LaunchLug);
+        Assert.assertTrue(new LaunchLugHandler(new BodyTube(), new WarningSet()).getComponent() instanceof LaunchLug);
     }
 
     /**
@@ -175,8 +137,9 @@ public class LaunchLugHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetMaterialType() throws Exception {
-        assertEquals(Material.Type.BULK, new LaunchLugHandler(new BodyTube(), new WarningSet()).getMaterialType());
+        Assert.assertEquals(Material.Type.BULK, new LaunchLugHandler(new BodyTube(), new WarningSet()).getMaterialType());
     }
 
 
index 36f17c11ac38d9d46dc6df1f764f140a73b6ec79..fa72a43f057a64c54e75e937dbc23935a36c6218 100644 (file)
@@ -3,14 +3,13 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import net.sf.openrocket.aerodynamics.WarningSet;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.BodyTube;
 import net.sf.openrocket.rocketcomponent.MassComponent;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
+import org.junit.Assert;
 
 import java.util.HashMap;
 
@@ -20,58 +19,17 @@ import java.util.HashMap;
  */
 public class MassObjectHandlerTest extends RocksimTestBase {
 
-    /**
-     * The class under test.
-     */
-    public static final Class classUT = MassObjectHandler.class;
-
-    /**
-     * The test class (this class).
-     */
-    public static final Class testClass = MassObjectHandlerTest.class;
-
-    /**
-     * Create a test suite of all tests within this test class.
-     *
-     * @return a suite of tests
-     */
-    public static Test suite() {
-        return new TestSuite(MassObjectHandlerTest.class);
-    }
-
-    /**
-     * Test constructor.
-     *
-     * @param name the name of the test to run.
-     */
-    public MassObjectHandlerTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Setup the fixture.
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Teardown the fixture.
-     */
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
     /**
      * Method: constructor
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testConstructor() throws Exception {
 
         try {
             new MassObjectHandler(null, new WarningSet());
-            fail("Should have thrown IllegalArgumentException");
+            Assert.fail("Should have thrown IllegalArgumentException");
         }
         catch (IllegalArgumentException iae) {
             //success
@@ -88,8 +46,9 @@ public class MassObjectHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testOpenElement() throws Exception {
-        assertEquals(PlainTextHandler.INSTANCE, new MassObjectHandler(new BodyTube(), new WarningSet()).openElement(null, null, null));
+        Assert.assertEquals(PlainTextHandler.INSTANCE, new MassObjectHandler(new BodyTube(), new WarningSet()).openElement(null, null, null));
     }
 
     /**
@@ -98,6 +57,7 @@ public class MassObjectHandlerTest extends RocksimTestBase {
      *
      * @throws Exception  thrown if something goes awry
      */
+    @org.junit.Test
     public void testCloseElement() throws Exception {
         BodyTube tube = new BodyTube();
         HashMap<String, String> attributes = new HashMap<String, String>();
@@ -107,23 +67,23 @@ public class MassObjectHandlerTest extends RocksimTestBase {
         MassComponent component = (MassComponent) getField(handler, "mass");
 
         handler.closeElement("Len", attributes, "-1", warnings);
-        assertEquals(0d, component.getLength());
+        Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        assertEquals(10d / (MassObjectHandler.MASS_LEN_FUDGE_FACTOR * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH)
-                , component.getLength());
+        Assert.assertEquals(10d / (MassObjectHandler.MASS_LEN_FUDGE_FACTOR * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH)
+                , component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        assertEquals(10d / (MassObjectHandler.MASS_LEN_FUDGE_FACTOR * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH)
-                , component.getLength());
+        Assert.assertEquals(10d / (MassObjectHandler.MASS_LEN_FUDGE_FACTOR * RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH)
+                , component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("KnownMass", attributes, "-1", warnings);
-        assertEquals(0d, component.getComponentMass());
+        Assert.assertEquals(0d, component.getComponentMass(), 0.001);
         handler.closeElement("KnownMass", attributes, "100", warnings);
-        assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS, component.getComponentMass());
+        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_MASS, component.getComponentMass(), 0.001);
         handler.closeElement("KnownMass", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
     }
@@ -133,12 +93,13 @@ public class MassObjectHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testSetRelativePosition() throws Exception {
         BodyTube tube = new BodyTube();
         MassObjectHandler handler = new MassObjectHandler(tube, new WarningSet());
         MassComponent component = (MassComponent) getField(handler, "mass");
         handler.setRelativePosition(RocketComponent.Position.ABSOLUTE);
-        assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
+        Assert.assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
     }
 
     /**
@@ -146,8 +107,9 @@ public class MassObjectHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetComponent() throws Exception {
-        assertTrue(new MassObjectHandler(new BodyTube(), new WarningSet()).getComponent() instanceof MassComponent);
+        Assert.assertTrue(new MassObjectHandler(new BodyTube(), new WarningSet()).getComponent() instanceof MassComponent);
     }
 
     /**
@@ -155,9 +117,8 @@ public class MassObjectHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetMaterialType() throws Exception {
-        assertEquals(Material.Type.BULK, new MassObjectHandler(new BodyTube(), new WarningSet()).getMaterialType());
+        Assert.assertEquals(Material.Type.BULK, new MassObjectHandler(new BodyTube(), new WarningSet()).getMaterialType());
     }
-
-
 }
index 75bc914641ed05d1d11fe2c89924f04c6623ef40..92dbb459d496438608fefc935cbb96b43bc0a090 100644 (file)
@@ -3,8 +3,6 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import net.sf.openrocket.aerodynamics.WarningSet;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
@@ -12,6 +10,8 @@ import net.sf.openrocket.rocketcomponent.ExternalComponent;
 import net.sf.openrocket.rocketcomponent.NoseCone;
 import net.sf.openrocket.rocketcomponent.Stage;
 import net.sf.openrocket.rocketcomponent.Transition;
+import org.junit.Assert;
+import org.junit.Test;
 
 import java.util.HashMap;
 
@@ -21,58 +21,17 @@ import java.util.HashMap;
  */
 public class NoseConeHandlerTest extends RocksimTestBase {
 
-    /**
-     * The class under test.
-     */
-    public static final Class classUT = NoseConeHandler.class;
-
-    /**
-     * The test class (this class).
-     */
-    public static final Class testClass = NoseConeHandlerTest.class;
-
-    /**
-     * Create a test suite of all tests within this test class.
-     *
-     * @return a suite of tests
-     */
-    public static Test suite() {
-        return new TestSuite(NoseConeHandlerTest.class);
-    }
-
-    /**
-     * Test constructor.
-     *
-     * @param name the name of the test to run.
-     */
-    public NoseConeHandlerTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Setup the fixture.
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Teardown the fixture.
-     */
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
     /**
      * Method: constructor
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testConstructor() throws Exception {
 
         try {
             new NoseConeHandler(null, new WarningSet());
-            fail("Should have thrown IllegalArgumentException");
+            Assert.fail("Should have thrown IllegalArgumentException");
         }
         catch (IllegalArgumentException iae) {
             //success
@@ -89,9 +48,10 @@ public class NoseConeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testOpenElement() throws Exception {
-        assertEquals(PlainTextHandler.INSTANCE, new NoseConeHandler(new Stage(), new WarningSet()).openElement(null, null, null));
-        assertNotNull(new NoseConeHandler(new Stage(), new WarningSet()).openElement("AttachedParts", null, null));
+        Assert.assertEquals(PlainTextHandler.INSTANCE, new NoseConeHandler(new Stage(), new WarningSet()).openElement(null, null, null));
+        Assert.assertNotNull(new NoseConeHandler(new Stage(), new WarningSet()).openElement("AttachedParts", null, null));
     }
 
     /**
@@ -100,6 +60,7 @@ public class NoseConeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception  thrown if something goes awry
      */
+    @Test
     public void testCloseElement() throws Exception {
 
         Stage stage = new Stage();
@@ -110,32 +71,32 @@ public class NoseConeHandlerTest extends RocksimTestBase {
         NoseCone component = (NoseCone) getField(handler, "noseCone");
 
         handler.closeElement("ShapeCode", attributes, "0", warnings);
-        assertEquals(Transition.Shape.CONICAL, component.getType());
+        Assert.assertEquals(Transition.Shape.CONICAL, component.getType());
         handler.closeElement("ShapeCode", attributes, "1", warnings);
-        assertEquals(Transition.Shape.OGIVE, component.getType());
+        Assert.assertEquals(Transition.Shape.OGIVE, component.getType());
         handler.closeElement("ShapeCode", attributes, "17", warnings);
-        assertEquals(RocksimNoseConeCode.PARABOLIC.asOpenRocket(), component.getType());  //test of default
+        Assert.assertEquals(RocksimNoseConeCode.PARABOLIC.asOpenRocket(), component.getType());  //test of default
         handler.closeElement("ShapeCode", attributes, "foo", warnings);
-        assertNotNull(component.getType());
-        assertEquals(1, warnings.size());
+        Assert.assertNotNull(component.getType());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Len", attributes, "-1", warnings);
-        assertEquals(0d, component.getLength());
+        Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("BaseDia", attributes, "-1", warnings);
-        assertEquals(0d, component.getAftRadius());
+        Assert.assertEquals(0d, component.getAftRadius(), 0.001);
         handler.closeElement("BaseDia", attributes, "100", warnings);
-        assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftRadius());
+        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftRadius(), 0.001);
         handler.closeElement("BaseDia", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         
@@ -146,53 +107,53 @@ public class NoseConeHandlerTest extends RocksimTestBase {
         component.setAftShoulderRadius(1.1d);
         handler.closeElement("WallThickness", attributes, "-1", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        assertEquals(component.getAftRadius(), component.getThickness());
-        assertEquals(component.getAftShoulderThickness(), component.getAftShoulderThickness());
+        Assert.assertEquals(component.getAftRadius(), component.getThickness(), 0.001);
+        Assert.assertEquals(component.getAftShoulderThickness(), component.getAftShoulderThickness(), 0.001);
         handler.closeElement("WallThickness", attributes, "100", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        assertEquals(aft, component.getThickness());
+        Assert.assertEquals(aft, component.getThickness(), 0.001);
         handler.closeElement("WallThickness", attributes, "foo", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
         
         handler.closeElement("ConstructionType", attributes, "1", warnings);
         component.setAftShoulderRadius(1.1d);
         handler.closeElement("WallThickness", attributes, "-1", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        assertEquals(0d, component.getThickness());
-        assertEquals(0d, component.getAftShoulderThickness());
+        Assert.assertEquals(0d, component.getThickness(), 0.001);
+        Assert.assertEquals(0d, component.getAftShoulderThickness(), 0.001);
         handler.closeElement("WallThickness", attributes, "1.1", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getThickness());
-        assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderThickness());
+        Assert.assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getThickness(), 0.001);
+        Assert.assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderThickness(), 0.001);
         
         handler.closeElement("ShoulderLen", attributes, "-1", warnings);
-        assertEquals(0d, component.getAftShoulderLength());
+        Assert.assertEquals(0d, component.getAftShoulderLength(), 0.001);
         handler.closeElement("ShoulderLen", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength(), 0.001);
         handler.closeElement("ShoulderLen", attributes, "10.0", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength(), 0.001);
         handler.closeElement("ShoulderLen", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("ShoulderOD", attributes, "-1", warnings);
-        assertEquals(0d, component.getAftShoulderRadius());
+        Assert.assertEquals(0d, component.getAftShoulderRadius(), 0.001);
         handler.closeElement("ShoulderOD", attributes, "100", warnings);
-        assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftShoulderRadius());
+        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftShoulderRadius(), 0.001);
         handler.closeElement("ShoulderOD", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         component.setType(Transition.Shape.HAACK);
         handler.closeElement("ShapeParameter", attributes, "-1", warnings);
-        assertEquals(0d, component.getShapeParameter());
+        Assert.assertEquals(0d, component.getShapeParameter(), 0.001);
         handler.closeElement("ShapeParameter", attributes, "100", warnings);
-        assertEquals(Transition.Shape.HAACK.maxParameter(), component.getShapeParameter());
+        Assert.assertEquals(Transition.Shape.HAACK.maxParameter(), component.getShapeParameter(), 0.001);
         handler.closeElement("ShapeParameter", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
-        assertEquals("Could not convert ShapeParameter value of foo.  It is expected to be a number.", 
+        Assert.assertEquals(1, warnings.size());
+        Assert.assertEquals("Could not convert ShapeParameter value of foo.  It is expected to be a number.", 
                      warnings.iterator().next().toString());
 
         warnings.clear();
@@ -200,22 +161,22 @@ public class NoseConeHandlerTest extends RocksimTestBase {
         component.setType(Transition.Shape.CONICAL);
         component.setShapeParameter(0d);
         handler.closeElement("ShapeParameter", attributes, "100", warnings);
-        assertEquals(0d, component.getShapeParameter());
+        Assert.assertEquals(0d, component.getShapeParameter(), 0.001);
 
         handler.closeElement("FinishCode", attributes, "-1", warnings);
-        assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
+        Assert.assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
         handler.closeElement("FinishCode", attributes, "100", warnings);
-        assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
+        Assert.assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
         handler.closeElement("FinishCode", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Name", attributes, "Test Name", warnings);
-        assertEquals("Test Name", component.getName());
+        Assert.assertEquals("Test Name", component.getName());
         
         handler.closeElement("Material", attributes, "Some Material", warnings);
         handler.endHandler("NoseCone", attributes, null, warnings);
-        assertTrue(component.getMaterial().getName().contains("Some Material"));
+        Assert.assertTrue(component.getMaterial().getName().contains("Some Material"));
      }
 
     /**
@@ -223,8 +184,9 @@ public class NoseConeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testGetComponent() throws Exception {
-        assertTrue(new NoseConeHandler(new Stage(), new WarningSet()).getComponent() instanceof NoseCone);
+        Assert.assertTrue(new NoseConeHandler(new Stage(), new WarningSet()).getComponent() instanceof NoseCone);
     }
 
     /**
@@ -232,7 +194,8 @@ public class NoseConeHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testGetMaterialType() throws Exception {
-        assertEquals(Material.Type.BULK, new NoseConeHandler(new Stage(), new WarningSet()).getMaterialType());
+        Assert.assertEquals(Material.Type.BULK, new NoseConeHandler(new Stage(), new WarningSet()).getMaterialType());
     }
 }
index ae9ca2aa74a9f57c58e4b1e029d906d8c392b68a..f1037d2ab9411db26c5d741a2c4f616c41565320 100644 (file)
@@ -3,14 +3,13 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import net.sf.openrocket.aerodynamics.WarningSet;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.BodyTube;
 import net.sf.openrocket.rocketcomponent.Parachute;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
+import org.junit.Assert;
 
 import java.util.HashMap;
 
@@ -19,55 +18,14 @@ import java.util.HashMap;
  */
 public class ParachuteHandlerTest extends RocksimTestBase {
 
-    /**
-     * The class under test.
-     */
-    public static final Class classUT = ParachuteHandler.class;
-
-    /**
-     * The test class (this class).
-     */
-    public static final Class testClass = ParachuteHandlerTest.class;
-
-    /**
-     * Create a test suite of all tests within this test class.
-     *
-     * @return a suite of tests
-     */
-    public static Test suite() {
-        return new TestSuite(ParachuteHandlerTest.class);
-    }
-
-    /**
-     * Test constructor.
-     *
-     * @param name the name of the test to run.
-     */
-    public ParachuteHandlerTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Setup the fixture.
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Teardown the fixture.
-     */
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
     /**
      * Method: openElement(String element, HashMap<String, String> attributes, WarningSet warnings)
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testOpenElement() throws Exception {
-        assertEquals(PlainTextHandler.INSTANCE, new ParachuteHandler(new BodyTube(), new WarningSet()).openElement(null, null, null));
+        Assert.assertEquals(PlainTextHandler.INSTANCE, new ParachuteHandler(new BodyTube(), new WarningSet()).openElement(null, null, null));
     }
 
     /**
@@ -75,6 +33,7 @@ public class ParachuteHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testCloseElement() throws Exception {
 
         BodyTube tube = new BodyTube();
@@ -84,38 +43,38 @@ public class ParachuteHandlerTest extends RocksimTestBase {
         WarningSet warnings = new WarningSet();
 
         handler.closeElement("Name", attributes, "Test Name", warnings);
-        assertEquals("Test Name", component.getName());
+        Assert.assertEquals("Test Name", component.getName());
 
         handler.closeElement("DragCoefficient", attributes, "0.94", warnings);
-        assertEquals(0.94d, component.getCD());
+        Assert.assertEquals(0.94d, component.getCD(), 0.001);
         handler.closeElement("DragCoefficient", attributes, "-0.94", warnings);
-        assertEquals(-0.94d, component.getCD());
+        Assert.assertEquals(-0.94d, component.getCD(), 0.001);
         handler.closeElement("DragCoefficient", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Dia", attributes, "-1", warnings);
-        assertEquals(-1d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getDiameter());
+        Assert.assertEquals(-1d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getDiameter(), 0.001);
         handler.closeElement("Dia", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getDiameter());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getDiameter(), 0.001);
         handler.closeElement("Dia", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("ShroudLineCount", attributes, "-1", warnings);
-        assertEquals(0, component.getLineCount());
+        Assert.assertEquals(0, component.getLineCount());
         handler.closeElement("ShroudLineCount", attributes, "10", warnings);
-        assertEquals(10, component.getLineCount());
+        Assert.assertEquals(10, component.getLineCount());
         handler.closeElement("ShroudLineCount", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("ShroudLineLen", attributes, "-1", warnings);
-        assertEquals(0d, component.getLineLength());
+        Assert.assertEquals(0d, component.getLineLength(), 0.001);
         handler.closeElement("ShroudLineLen", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLineLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLineLength(), 0.001);
         handler.closeElement("ShroudLineLen", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
     }
@@ -125,11 +84,12 @@ public class ParachuteHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testConstructor() throws Exception {
 
         try {
             new ParachuteHandler(null, new WarningSet());
-            fail("Should have thrown IllegalArgumentException");
+            Assert.fail("Should have thrown IllegalArgumentException");
         }
         catch (IllegalArgumentException iae) {
             //success
@@ -146,12 +106,13 @@ public class ParachuteHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testSetRelativePosition() throws Exception {
         BodyTube tube = new BodyTube();
         ParachuteHandler handler = new ParachuteHandler(tube, new WarningSet());
         Parachute component = (Parachute) getField(handler, "chute");
         handler.setRelativePosition(RocketComponent.Position.ABSOLUTE);
-        assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
+        Assert.assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
     }
 
     /**
@@ -159,8 +120,9 @@ public class ParachuteHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetComponent() throws Exception {
-        assertTrue(new ParachuteHandler(new BodyTube(), new WarningSet()).getComponent() instanceof Parachute);
+        Assert.assertTrue(new ParachuteHandler(new BodyTube(), new WarningSet()).getComponent() instanceof Parachute);
     }
 
     /**
@@ -168,8 +130,9 @@ public class ParachuteHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetMaterialType() throws Exception {
-        assertEquals(Material.Type.SURFACE, new ParachuteHandler(new BodyTube(), new WarningSet()).getMaterialType());
+        Assert.assertEquals(Material.Type.SURFACE, new ParachuteHandler(new BodyTube(), new WarningSet()).getMaterialType());
     }
 
     /**
@@ -177,6 +140,7 @@ public class ParachuteHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testEndHandler() throws Exception {
         BodyTube tube = new BodyTube();
         ParachuteHandler handler = new ParachuteHandler(tube, new WarningSet());
@@ -187,15 +151,13 @@ public class ParachuteHandlerTest extends RocksimTestBase {
         handler.closeElement("Xb", attributes, "-10", warnings);
         handler.closeElement("LocationMode", attributes, "1", warnings);
         handler.endHandler("Parachute", attributes, null, warnings);
-        assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
-        assertEquals(component.getPositionValue(), -10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+        Assert.assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
+        Assert.assertEquals(component.getPositionValue(), -10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
 
         handler.closeElement("Xb", attributes, "-10", warnings);
         handler.closeElement("LocationMode", attributes, "2", warnings);
         handler.endHandler("Parachute", attributes, null, warnings);
-        assertEquals(RocketComponent.Position.BOTTOM, component.getRelativePosition());
-        assertEquals(component.getPositionValue(), 10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+        Assert.assertEquals(RocketComponent.Position.BOTTOM, component.getRelativePosition());
+        Assert.assertEquals(component.getPositionValue(), 10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
     }
-
-
 }
index e96355a989c77e133dd804fdf77e34b265d52ee8..b238eb9d197ce03183f1cdda2c849c332cc5ac90 100644 (file)
@@ -3,14 +3,18 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import net.sf.openrocket.aerodynamics.WarningSet;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.BodyTube;
+import net.sf.openrocket.rocketcomponent.Bulkhead;
 import net.sf.openrocket.rocketcomponent.CenteringRing;
+import net.sf.openrocket.rocketcomponent.EngineBlock;
+import net.sf.openrocket.rocketcomponent.RingComponent;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
+import net.sf.openrocket.rocketcomponent.TubeCoupler;
+import org.junit.Assert;
+import org.junit.Test;
 
 import java.util.HashMap;
 
@@ -19,55 +23,14 @@ import java.util.HashMap;
  */
 public class RingHandlerTest extends RocksimTestBase {
 
-    /**
-     * The class under test.
-     */
-    public static final Class classUT = RingHandler.class;
-
-    /**
-     * The test class (this class).
-     */
-    public static final Class testClass = RingHandlerTest.class;
-
-    /**
-     * Create a test suite of all tests within this test class.
-     *
-     * @return a suite of tests
-     */
-    public static Test suite() {
-        return new TestSuite(RingHandlerTest.class);
-    }
-
-    /**
-     * Test constructor.
-     *
-     * @param name the name of the test to run.
-     */
-    public RingHandlerTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Setup the fixture.
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Teardown the fixture.
-     */
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
     /**
      * Method: openElement(String element, HashMap<String, String> attributes, WarningSet warnings)
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testOpenElement() throws Exception {
-        assertEquals(PlainTextHandler.INSTANCE, new RingHandler(new BodyTube(), new WarningSet()).openElement(null, null, null));
+        Assert.assertEquals(PlainTextHandler.INSTANCE, new RingHandler(new BodyTube(), new WarningSet()).openElement(null, null, null));
     }
 
     /**
@@ -75,6 +38,7 @@ public class RingHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testCloseElement() throws Exception {
 
         BodyTube tube = new BodyTube();
@@ -84,46 +48,187 @@ public class RingHandlerTest extends RocksimTestBase {
         WarningSet warnings = new WarningSet();
 
         handler.closeElement("OD", attributes, "0", warnings);
-        assertEquals(0d, component.getOuterRadius());
+        Assert.assertEquals(0d, component.getOuterRadius(), 0.001);
         handler.closeElement("OD", attributes, "75", warnings);
-        assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getOuterRadius());
+        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getOuterRadius(), 0.001);
         handler.closeElement("OD", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("ID", attributes, "0", warnings);
-        assertEquals(0d, component.getInnerRadius());
+        Assert.assertEquals(0d, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "75", warnings);
-        assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius());
+        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getInnerRadius(), 0.001);
         handler.closeElement("ID", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Len", attributes, "-1", warnings);
-        assertEquals(0d, component.getLength());
+        Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Name", attributes, "Test Name", warnings);
-        assertEquals("Test Name", component.getName());
+        Assert.assertEquals("Test Name", component.getName());
     }
 
+    /**
+     * Test a bulkhead.
+     *
+     * @throws Exception thrown if something goes awry
+     */
+    @Test
+    public void testBulkhead() throws Exception {
+        BodyTube tube = new BodyTube();
+        RingHandler handler = new RingHandler(tube, new WarningSet());
+        CenteringRing component = (CenteringRing) getField(handler, "ring");
+        HashMap<String, String> attributes = new HashMap<String, String>();
+        WarningSet warnings = new WarningSet();
+
+        handler.closeElement("OD", attributes, "75", warnings);
+        handler.closeElement("ID", attributes, "0", warnings);
+        handler.closeElement("Len", attributes, "10", warnings);
+        handler.closeElement("Name", attributes, "Test Name", warnings);
+        handler.closeElement("KnownMass", attributes, "109.9", warnings);
+        handler.closeElement("UsageCode", attributes, "1", warnings);
+        handler.closeElement("UseKnownCG", attributes, "1", warnings);
+        handler.endHandler("", attributes, "", warnings);
+        
+        Assert.assertEquals(1, tube.getChildren().size());
+        RingComponent child = (RingComponent)tube.getChild(0);
+
+        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, child.getOuterRadius(), 0.001);
+        Assert.assertEquals(0d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, child.getInnerRadius(), 0.001);
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, child.getLength(), 0.001);
+        Assert.assertEquals("Test Name", child.getName());
+        Assert.assertEquals(109.9/1000, child.getMass(), 0.001);
+        Assert.assertEquals(0, child.getPositionValue(), 0.0);
+        Assert.assertEquals(RocketComponent.Position.TOP, child.getRelativePosition());
+        Assert.assertTrue(child instanceof Bulkhead);
+
+    }
+    
+    /**
+     * Test a tube coupler.
+     *
+     * @throws Exception thrown if something goes awry
+     */
+    @Test
+    public void testTubeCoupler() throws Exception {
+        BodyTube tube = new BodyTube();
+        RingHandler handler = new RingHandler(tube, new WarningSet());
+        HashMap<String, String> attributes = new HashMap<String, String>();
+        WarningSet warnings = new WarningSet();
+
+        handler.closeElement("OD", attributes, "75", warnings);
+        handler.closeElement("ID", attributes, "70", warnings);
+        handler.closeElement("Len", attributes, "10", warnings);
+        handler.closeElement("Name", attributes, "Test Name", warnings);
+        handler.closeElement("KnownMass", attributes, "109.9", warnings);
+        handler.closeElement("UsageCode", attributes, "4", warnings);
+        handler.closeElement("UseKnownCG", attributes, "1", warnings);
+        handler.endHandler("", attributes, "", warnings);
+
+        Assert.assertEquals(1, tube.getChildren().size());
+        RingComponent child = (RingComponent)tube.getChild(0);
+        Assert.assertTrue(child instanceof TubeCoupler);
+
+        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, child.getOuterRadius(), 0.001);
+        Assert.assertEquals(70d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, child.getInnerRadius(), 0.001);
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, child.getLength(), 0.001);
+        Assert.assertEquals("Test Name", child.getName());
+        Assert.assertEquals(109.9/1000, child.getMass(), 0.001);
+        Assert.assertEquals(0, child.getPositionValue(), 0.0);
+        Assert.assertEquals(RocketComponent.Position.TOP, child.getRelativePosition());
+    }
+
+    /**
+     * Test a engine block.
+     *
+     * @throws Exception thrown if something goes awry
+     */
+    @Test
+    public void testEngineBlock() throws Exception {
+        BodyTube tube = new BodyTube();
+        RingHandler handler = new RingHandler(tube, new WarningSet());
+        HashMap<String, String> attributes = new HashMap<String, String>();
+        WarningSet warnings = new WarningSet();
+
+        handler.closeElement("OD", attributes, "75", warnings);
+        handler.closeElement("ID", attributes, "70", warnings);
+        handler.closeElement("Len", attributes, "10", warnings);
+        handler.closeElement("Name", attributes, "Test Name", warnings);
+        handler.closeElement("KnownMass", attributes, "109.9", warnings);
+        handler.closeElement("UsageCode", attributes, "2", warnings);
+        handler.closeElement("KnownCG", attributes, "4", warnings);
+        handler.closeElement("UseKnownCG", attributes, "1", warnings);
+        handler.endHandler("", attributes, "", warnings);
+
+        Assert.assertEquals(1, tube.getChildren().size());
+        RingComponent child = (RingComponent)tube.getChild(0);
+        Assert.assertTrue(child instanceof EngineBlock);
+
+        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, child.getOuterRadius(), 0.001);
+        Assert.assertEquals(70d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, child.getInnerRadius(), 0.001);
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, child.getLength(), 0.001);
+        Assert.assertEquals("Test Name", child.getName());
+        Assert.assertEquals(109.9/1000, child.getMass(), 0.001);
+        Assert.assertEquals(0, child.getPositionValue(), 0.0);
+        Assert.assertEquals(RocketComponent.Position.TOP, child.getRelativePosition());
+        Assert.assertEquals(4d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, child.getCG().x, 0.000001);
+        
+    }
+
+    /**
+     * Test a centering ring
+     *
+     * @throws Exception thrown if something goes awry
+     */
+    @Test
+    public void testRing() throws Exception {
+        BodyTube tube = new BodyTube();
+        RingHandler handler = new RingHandler(tube, new WarningSet());
+        HashMap<String, String> attributes = new HashMap<String, String>();
+        WarningSet warnings = new WarningSet();
+
+        handler.closeElement("OD", attributes, "75", warnings);
+        handler.closeElement("ID", attributes, "0", warnings);
+        handler.closeElement("Len", attributes, "10", warnings);
+        handler.closeElement("Name", attributes, "Test Name", warnings);
+        handler.closeElement("KnownMass", attributes, "109.9", warnings);
+        handler.closeElement("UsageCode", attributes, "0", warnings);
+        handler.closeElement("UseKnownCG", attributes, "1", warnings);
+        handler.endHandler("", attributes, "", warnings);
+
+        Assert.assertEquals(1, tube.getChildren().size());
+        RingComponent child = (RingComponent)tube.getChild(0);
+
+        Assert.assertEquals(75d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, child.getOuterRadius(), 0.001);
+        Assert.assertEquals(0d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, child.getInnerRadius(), 0.001);
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, child.getLength(), 0.001);
+        Assert.assertEquals("Test Name", child.getName());
+        Assert.assertEquals(109.9/1000, child.getMass(), 0.001);
+        Assert.assertEquals(0, child.getPositionValue(), 0.0);
+        Assert.assertEquals(RocketComponent.Position.TOP, child.getRelativePosition());
+        Assert.assertTrue(child instanceof CenteringRing);
+    }
 
     /**
      * Method: constructor
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testConstructor() throws Exception {
 
         try {
             new RingHandler(null, new WarningSet());
-            fail("Should have thrown IllegalArgumentException");
+            Assert.fail("Should have thrown IllegalArgumentException");
         }
         catch (IllegalArgumentException iae) {
             //success
@@ -132,7 +237,6 @@ public class RingHandlerTest extends RocksimTestBase {
         BodyTube tube = new BodyTube();
         RingHandler handler = new RingHandler(tube, new WarningSet());
         CenteringRing component = (CenteringRing) getField(handler, "ring");
-        assertContains(component, tube.getChildren());
     }
 
     /**
@@ -140,21 +244,24 @@ public class RingHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testSetRelativePosition() throws Exception {
         BodyTube tube = new BodyTube();
         RingHandler handler = new RingHandler(tube, new WarningSet());
         CenteringRing component = (CenteringRing) getField(handler, "ring");
         handler.setRelativePosition(RocketComponent.Position.ABSOLUTE);
-        assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
+        Assert.assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
     }
 
+    
     /**
      * Method: getComponent()
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetComponent() throws Exception {
-        assertTrue(new RingHandler(new BodyTube(), new WarningSet()).getComponent() instanceof CenteringRing);
+        Assert.assertTrue(new RingHandler(new BodyTube(), new WarningSet()).getComponent() instanceof CenteringRing);
     }
 
     /**
@@ -162,8 +269,9 @@ public class RingHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetMaterialType() throws Exception {
-        assertEquals(Material.Type.BULK, new RingHandler(new BodyTube(), new WarningSet()).getMaterialType());
+        Assert.assertEquals(Material.Type.BULK, new RingHandler(new BodyTube(), new WarningSet()).getMaterialType());
     }
 
 
index d0820cfc9782416a3ce74636a5981997daf9227b..b9edfb28d3e78269fbf572a6ee35e6ca2d619f8c 100644 (file)
@@ -3,57 +3,13 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import junit.framework.TestCase;
+import org.junit.Assert;
 
 /**
  * RocksimContentHandler Tester.
  *
  */
-public class RocksimContentHandlerTest extends TestCase {
-
-    /**
-     * The class under test.
-     */
-    public static final Class classUT = RocksimContentHandler.class;
-
-    /**
-     * The test class (this class).
-     */
-    public static final Class testClass = RocksimContentHandlerTest.class;
-
-    /**
-     * Create a test suite of all tests within this test class.
-     *
-     * @return a suite of tests
-     */
-    public static Test suite() {
-        return new TestSuite(RocksimContentHandlerTest.class);
-    }
-
-    /**
-     * Test constructor.
-     *
-     * @param name the name of the test to run.
-     */
-    public RocksimContentHandlerTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Setup the fixture.
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Teardown the fixture.
-     */
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
+public class RocksimContentHandlerTest {
 
     /**
      *
@@ -61,9 +17,10 @@ public class RocksimContentHandlerTest extends TestCase {
      *
      * @throws Exception  thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetDocument() throws Exception {
         RocksimContentHandler handler = new RocksimContentHandler();
-        assertNotNull(handler.getDocument());
+        Assert.assertNotNull(handler.getDocument());
     }
 
 }
index 1ea1f98934eb8af5c7f2ddee7b2bcb9f8fed7edd..83b1fab59240bc149e34858bc3a51cd9db2ed31f 100644 (file)
@@ -4,14 +4,12 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
 import net.sf.openrocket.document.OpenRocketDocument;
 import net.sf.openrocket.rocketcomponent.BodyTube;
 import net.sf.openrocket.rocketcomponent.LaunchLug;
 import net.sf.openrocket.rocketcomponent.Rocket;
 import net.sf.openrocket.rocketcomponent.Stage;
+import org.junit.Assert;
 
 import java.io.BufferedInputStream;
 import java.io.InputStream;
@@ -20,69 +18,28 @@ import java.io.InputStream;
  * RocksimLoader Tester.
  *
  */
-public class RocksimLoaderTest extends TestCase {
-
-    /**
-     * The class under test.
-     */
-    public static final Class classUT = RocksimLoader.class;
-
-    /**
-     * The test class (this class).
-     */
-    public static final Class testClass = RocksimLoaderTest.class;
-
-    /**
-     * Create a test suite of all tests within this test class.
-     *
-     * @return a suite of tests
-     */
-    public static Test suite() {
-        return new TestSuite(RocksimLoaderTest.class);
-    }
-
-    /**
-     * Test constructor.
-     *
-     * @param name the name of the test to run.
-     */
-    public RocksimLoaderTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Setup the fixture.
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Teardown the fixture.
-     */
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
+public class RocksimLoaderTest {
 
     /**
      * Test a bug reported via automated bug report.  I have been unable to reproduce this bug
      * (hanging finset off of an inner body tube) when creating a Rocksim file using Rocksim.  The bug
      * is reproducible when manually modifying the Rocksim file, which is what is tested here.
      */
+    @org.junit.Test
     public void testFinsOnInnerTube() throws Exception {
         RocksimLoader loader = new RocksimLoader();
         InputStream stream = this.getClass().getResourceAsStream("PodFins.rkt");
-        assertNotNull("Could not open PodFins.rkt", stream);
+        Assert.assertNotNull("Could not open PodFins.rkt", stream);
         try {
             OpenRocketDocument doc = loader.loadFromStream(new BufferedInputStream(stream));
-            assertNotNull(doc);
+            Assert.assertNotNull(doc);
             Rocket rocket = doc.getRocket();
-            assertNotNull(rocket);
+            Assert.assertNotNull(rocket);
         }
         catch (IllegalStateException ise) {
-            fail(ise.getMessage());            
+            Assert.fail(ise.getMessage());
         }
-        assertTrue(loader.getWarnings().size() == 2);
+        Assert.assertTrue(loader.getWarnings().size() == 2);
     }
 
     /**
@@ -91,84 +48,85 @@ public class RocksimLoaderTest extends TestCase {
      *
      * @throws Exception  thrown if something goes awry
      */
+    @org.junit.Test
     public void testLoadFromStream() throws Exception {
         RocksimLoader loader = new RocksimLoader();
         //Stupid single stage rocket
         InputStream stream = this.getClass().getResourceAsStream("rocksimTestRocket1.rkt");
-        assertNotNull("Could not open rocksimTestRocket1.rkt", stream);
+        Assert.assertNotNull("Could not open rocksimTestRocket1.rkt", stream);
         OpenRocketDocument doc = loader.loadFromStream(new BufferedInputStream(stream));
         
-        assertNotNull(doc);
+        Assert.assertNotNull(doc);
         Rocket rocket = doc.getRocket();
-        assertNotNull(rocket);
-        assertEquals("FooBar Test", doc.getRocket().getName());
-        assertTrue(loader.getWarnings().isEmpty());
+        Assert.assertNotNull(rocket);
+        Assert.assertEquals("FooBar Test", doc.getRocket().getName());
+        Assert.assertTrue(loader.getWarnings().isEmpty());
 
         stream = this.getClass().getResourceAsStream("rocksimTestRocket2.rkt");
-        assertNotNull("Could not open rocksimTestRocket2.rkt", stream);
+        Assert.assertNotNull("Could not open rocksimTestRocket2.rkt", stream);
         doc = loader.loadFromStream(new BufferedInputStream(stream));
         
-        assertNotNull(doc);
+        Assert.assertNotNull(doc);
         rocket = doc.getRocket();
-        assertNotNull(rocket);
+        Assert.assertNotNull(rocket);
 
         //Do some simple asserts;  the important thing here is just validating that the mass and cg were
         //not overridden for each stage.
-        assertEquals("Three Stage Everything Included Rocket", doc.getRocket().getName());
-        assertEquals(1, loader.getWarnings().size());
-        assertEquals(3, rocket.getStageCount());  
+        Assert.assertEquals("Three Stage Everything Included Rocket", doc.getRocket().getName());
+        Assert.assertEquals(1, loader.getWarnings().size());
+        Assert.assertEquals(3, rocket.getStageCount());
         Stage stage1 = (Stage)rocket.getChild(0);
-        assertFalse(stage1.isMassOverridden());
-        assertFalse(stage1.isCGOverridden());
+        Assert.assertFalse(stage1.isMassOverridden());
+        Assert.assertFalse(stage1.isCGOverridden());
         Stage stage2 = (Stage)rocket.getChild(1);
-        assertFalse(stage2.isMassOverridden());
-        assertFalse(stage2.isCGOverridden());
+        Assert.assertFalse(stage2.isMassOverridden());
+        Assert.assertFalse(stage2.isCGOverridden());
         Stage stage3 = (Stage)rocket.getChild(2);
-        assertFalse(stage3.isMassOverridden());
-        assertFalse(stage3.isCGOverridden());
+        Assert.assertFalse(stage3.isMassOverridden());
+        Assert.assertFalse(stage3.isCGOverridden());
 
         stream = this.getClass().getResourceAsStream("rocksimTestRocket3.rkt");
-        assertNotNull("Could not open rocksimTestRocket3.rkt", stream);
+        Assert.assertNotNull("Could not open rocksimTestRocket3.rkt", stream);
         doc = loader.loadFromStream(new BufferedInputStream(stream));
         
-        assertNotNull(doc);
+        Assert.assertNotNull(doc);
         rocket = doc.getRocket();
-        assertNotNull(rocket);
-        assertEquals("Three Stage Everything Included Rocket - Override Total Mass/CG", doc.getRocket().getName());
-        assertEquals(3, rocket.getStageCount());  
+        Assert.assertNotNull(rocket);
+        Assert.assertEquals("Three Stage Everything Included Rocket - Override Total Mass/CG", doc.getRocket().getName());
+        Assert.assertEquals(3, rocket.getStageCount());
         stage1 = (Stage)rocket.getChild(0);
         stage2 = (Stage)rocket.getChild(1);
         stage3 = (Stage)rocket.getChild(2);
         
         //Do some 1st level and simple asserts; the idea here is to not do a deep validation as that 
         //should have been covered elsewhere.  Assert that the stage overrides are correct.
-        assertEquals(2, stage1.getChildCount());
-        assertEquals("Nose cone", stage1.getChild(0).getName());
-        assertEquals("Body tube", stage1.getChild(1).getName());
-        assertTrue(stage1.isMassOverridden());
-        assertEquals(0.185d, stage1.getOverrideMass());
-        assertTrue(stage1.isCGOverridden());
-        assertEquals(0.3d, stage1.getOverrideCG().x);
-        assertEquals(4, loader.getWarnings().size());
+        Assert.assertEquals(2, stage1.getChildCount());
+        Assert.assertEquals("Nose cone", stage1.getChild(0).getName());
+        Assert.assertEquals("Body tube", stage1.getChild(1).getName());
+        Assert.assertTrue(stage1.isMassOverridden());
+        Assert.assertEquals(0.185d, stage1.getOverrideMass(), 0.001);
+        Assert.assertTrue(stage1.isCGOverridden());
+        Assert.assertEquals(0.3d, stage1.getOverrideCG().x, 0.001);
+        Assert.assertEquals(4, loader.getWarnings().size());
         
-        assertEquals(1, stage2.getChildCount());
-        assertEquals("2nd Stage Tube", stage2.getChild(0).getName());
-        assertTrue(stage2.isMassOverridden());
-        assertEquals(0.21d, stage2.getOverrideMass());
-        assertTrue(stage2.isCGOverridden());
-        assertEquals(0.4d, stage2.getOverrideCG().x);
+        Assert.assertEquals(1, stage2.getChildCount());
+        Assert.assertEquals("2nd Stage Tube", stage2.getChild(0).getName());
+        Assert.assertTrue(stage2.isMassOverridden());
+        Assert.assertEquals(0.21d, stage2.getOverrideMass(), 0.001);
+        Assert.assertTrue(stage2.isCGOverridden());
+        Assert.assertEquals(0.4d, stage2.getOverrideCG().x, 0.001);
         
         BodyTube bt = (BodyTube)stage2.getChild(0);
         LaunchLug ll = (LaunchLug)bt.getChild(6);
-        assertEquals(1.22d, ll.getRadialDirection());
+        Assert.assertEquals(1.22d, ll.getRadialDirection(), 0.001);
         
-        assertEquals(2, stage3.getChildCount());
-        assertEquals("Transition", stage3.getChild(0).getName());
-        assertEquals("Body tube", stage3.getChild(1).getName());
-        assertTrue(stage2.isMassOverridden());
-        assertEquals(0.33d, stage3.getOverrideMass());
-        assertTrue(stage2.isCGOverridden());
-        assertEquals(0.5d, stage3.getOverrideCG().x);
+        Assert.assertEquals(2, stage3.getChildCount());
+        Assert.assertEquals("Transition", stage3.getChild(0).getName());
+        Assert.assertEquals("Body tube", stage3.getChild(1).getName());
+        Assert.assertTrue(stage2.isMassOverridden());
+        Assert.assertEquals(0.33d, stage3.getOverrideMass(), 0.001);
+        Assert.assertTrue(stage2.isCGOverridden());
+        Assert.assertEquals(0.5d, stage3.getOverrideCG().x, 0.001);
     }
 
 }
index c3c38825206409dc73d3952c53fa1b2caa476d1a..82f1201a00b52f6e67d4e3f53e6d232953505d17 100644 (file)
@@ -3,41 +3,31 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import java.lang.reflect.Field;
-import java.util.List;
-
-import junit.framework.TestCase;
 import net.sf.openrocket.gui.util.SwingPreferences;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
 import net.sf.openrocket.startup.Application;
+import org.junit.Assert;
+import org.junit.Before;
+
+import java.lang.reflect.Field;
+import java.util.List;
 
 /**
  * A base class for the Rocksim tests.  Includes code from the junitx.addons project.
  */
-public abstract class RocksimTestBase extends TestCase {
-       
-       /**
-        * Test constructor.
-        *
-        * @param name the name of the test to run.
-        */
-       public RocksimTestBase(String name) {
-               super(name);
-       }
-       
+public abstract class RocksimTestBase {
        
        /* (non-Javadoc)
         * @see junit.framework.TestCase#setUp()
         */
-       @Override
-       protected void setUp() throws Exception {
-               super.setUp();
-               Application.setPreferences( new SwingPreferences() );
+       @Before
+    public void setUp() throws Exception {
+        Application.setPreferences( new SwingPreferences() );
        }
 
 
        public void assertContains(RocketComponent child, List<RocketComponent> components) {
-               assertTrue("Components did not contain child", components.contains(child));
+               Assert.assertTrue("Components did not contain child", components.contains(child));
        }
        
        /**
index 092f5d09e2c9d2cf967d9f88490d6ffbef95be6b..3730f88d628e1f6168403c697f19358e5f30d08c 100644 (file)
@@ -3,14 +3,14 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import net.sf.openrocket.aerodynamics.WarningSet;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.BodyTube;
 import net.sf.openrocket.rocketcomponent.RocketComponent;
 import net.sf.openrocket.rocketcomponent.Streamer;
+import org.junit.Assert;
+import org.junit.Test;
 
 import java.util.HashMap;
 
@@ -19,55 +19,14 @@ import java.util.HashMap;
  */
 public class StreamerHandlerTest extends RocksimTestBase {
 
-    /**
-     * The class under test.
-     */
-    public static final Class classUT = StreamerHandler.class;
-
-    /**
-     * The test class (this class).
-     */
-    public static final Class testClass = StreamerHandlerTest.class;
-
-    /**
-     * Create a test suite of all tests within this test class.
-     *
-     * @return a suite of tests
-     */
-    public static Test suite() {
-        return new TestSuite(StreamerHandlerTest.class);
-    }
-
-    /**
-     * Test constructor.
-     *
-     * @param name the name of the test to run.
-     */
-    public StreamerHandlerTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Setup the fixture.
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Teardown the fixture.
-     */
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
     /**
      * Method: openElement(String element, HashMap<String, String> attributes, WarningSet warnings)
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testOpenElement() throws Exception {
-        assertEquals(PlainTextHandler.INSTANCE, new StreamerHandler(new BodyTube(), new WarningSet()).openElement(null, null, null));
+        Assert.assertEquals(PlainTextHandler.INSTANCE, new StreamerHandler(new BodyTube(), new WarningSet()).openElement(null, null, null));
     }
 
     /**
@@ -75,6 +34,7 @@ public class StreamerHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testCloseElement() throws Exception {
 
         BodyTube tube = new BodyTube();
@@ -84,32 +44,32 @@ public class StreamerHandlerTest extends RocksimTestBase {
         WarningSet warnings = new WarningSet();
 
         handler.closeElement("Width", attributes, "0", warnings);
-        assertEquals(0d/ RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripWidth());
+        Assert.assertEquals(0d/ RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripWidth(), 0.001);
         handler.closeElement("Width", attributes, "10", warnings);
-        assertEquals(10d/ RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripWidth());
+        Assert.assertEquals(10d/ RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripWidth(), 0.001);
         handler.closeElement("Width", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Len", attributes, "-1", warnings);
-        assertEquals(0d, component.getStripLength());
+        Assert.assertEquals(0d, component.getStripLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getStripLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Name", attributes, "Test Name", warnings);
-        assertEquals("Test Name", component.getName());
+        Assert.assertEquals("Test Name", component.getName());
 
         handler.closeElement("DragCoefficient", attributes, "0.94", warnings);
-        assertEquals(0.94d, component.getCD());
+        Assert.assertEquals(0.94d, component.getCD(), 0.001);
         handler.closeElement("DragCoefficient", attributes, "-0.94", warnings);
-        assertEquals(-0.94d, component.getCD());
+        Assert.assertEquals(-0.94d, component.getCD(), 0.001);
         handler.closeElement("DragCoefficient", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
     }
@@ -119,11 +79,12 @@ public class StreamerHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testConstructor() throws Exception {
 
         try {
             new StreamerHandler(null, new WarningSet());
-            fail("Should have thrown IllegalArgumentException");
+            Assert.fail("Should have thrown IllegalArgumentException");
         }
         catch (IllegalArgumentException iae) {
             //success
@@ -140,12 +101,13 @@ public class StreamerHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testSetRelativePosition() throws Exception {
         BodyTube tube = new BodyTube();
         StreamerHandler handler = new StreamerHandler(tube, new WarningSet());
         Streamer component = (Streamer) getField(handler, "streamer");
         handler.setRelativePosition(RocketComponent.Position.ABSOLUTE);
-        assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
+        Assert.assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
     }
 
     /**
@@ -153,8 +115,9 @@ public class StreamerHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testGetComponent() throws Exception {
-        assertTrue(new StreamerHandler(new BodyTube(), new WarningSet()).getComponent() instanceof Streamer);
+        Assert.assertTrue(new StreamerHandler(new BodyTube(), new WarningSet()).getComponent() instanceof Streamer);
     }
 
     /**
@@ -162,8 +125,9 @@ public class StreamerHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testGetMaterialType() throws Exception {
-        assertEquals(Material.Type.SURFACE, new StreamerHandler(new BodyTube(), new WarningSet()).getMaterialType());
+        Assert.assertEquals(Material.Type.SURFACE, new StreamerHandler(new BodyTube(), new WarningSet()).getMaterialType());
     }
 
     /**
@@ -171,6 +135,7 @@ public class StreamerHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @Test
     public void testEndHandler() throws Exception {
         BodyTube tube = new BodyTube();
         StreamerHandler handler = new StreamerHandler(tube, new WarningSet());
@@ -181,29 +146,29 @@ public class StreamerHandlerTest extends RocksimTestBase {
         handler.closeElement("Xb", attributes, "-10", warnings);
         handler.closeElement("LocationMode", attributes, "1", warnings);
         handler.endHandler("Streamer", attributes, null, warnings);
-        assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
-        assertEquals(component.getPositionValue(), -10d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+        Assert.assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
+        Assert.assertEquals(component.getPositionValue(), -10d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
 
         handler.closeElement("Xb", attributes, "-10", warnings);
         handler.closeElement("LocationMode", attributes, "2", warnings);
         handler.endHandler("Streamer", attributes, null, warnings);
-        assertEquals(RocketComponent.Position.BOTTOM, component.getRelativePosition());
-        assertEquals(component.getPositionValue(), 10d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH);
+        Assert.assertEquals(RocketComponent.Position.BOTTOM, component.getRelativePosition());
+        Assert.assertEquals(component.getPositionValue(), 10d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
 
         handler.closeElement("Thickness", attributes, "0.02", warnings);
-        assertEquals(0.01848, handler.computeDensity(RocksimDensityType.ROCKSIM_BULK, 924d));
+        Assert.assertEquals(0.01848, handler.computeDensity(RocksimDensityType.ROCKSIM_BULK, 924d), 0.001);
 
         //Test Density Type 0 (Bulk)
         handler.closeElement("Density", attributes, "924.0", warnings);
         handler.closeElement("DensityType", attributes, "0", warnings);
         handler.endHandler("Streamer", attributes, null, warnings);
-        assertEquals(0.01848d, component.getMaterial().getDensity());
+        Assert.assertEquals(0.01848d, component.getMaterial().getDensity(), 0.001);
 
         //Test Density Type 1 (Surface)
         handler.closeElement("Density", attributes, "0.006685", warnings);
         handler.closeElement("DensityType", attributes, "1", warnings);
         handler.endHandler("Streamer", attributes, null, warnings);
-        assertTrue(Math.abs(0.06685d - component.getMaterial().getDensity()) < 0.00001);
+        Assert.assertTrue(Math.abs(0.06685d - component.getMaterial().getDensity()) < 0.00001);
 
         //Test Density Type 2 (Line)
         handler.closeElement("Density", attributes, "0.223225", warnings);
@@ -212,7 +177,7 @@ public class StreamerHandlerTest extends RocksimTestBase {
         handler.closeElement("Width", attributes, "203.2", warnings);
         handler.endHandler("Streamer", attributes, null, warnings);
 
-        assertEquals(1.728190092, component.getMass());
+        Assert.assertEquals(1.728190092, component.getMass(), 0.001);
 
     }
 
index d28f53f8d49cd3555b719144db1df8e72e4db687..27542940b9d8337cdfc48c555640c14963f5b050 100644 (file)
@@ -3,14 +3,13 @@
  */
 package net.sf.openrocket.file.rocksim;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import net.sf.openrocket.aerodynamics.WarningSet;
 import net.sf.openrocket.file.simplesax.PlainTextHandler;
 import net.sf.openrocket.material.Material;
 import net.sf.openrocket.rocketcomponent.ExternalComponent;
 import net.sf.openrocket.rocketcomponent.Stage;
 import net.sf.openrocket.rocketcomponent.Transition;
+import org.junit.Assert;
 
 import java.util.HashMap;
 
@@ -19,58 +18,17 @@ import java.util.HashMap;
  */
 public class TransitionHandlerTest extends RocksimTestBase {
 
-    /**
-     * The class under test.
-     */
-    public static final Class classUT = TransitionHandler.class;
-
-    /**
-     * The test class (this class).
-     */
-    public static final Class testClass = TransitionHandlerTest.class;
-
-    /**
-     * Create a test suite of all tests within this test class.
-     *
-     * @return a suite of tests
-     */
-    public static Test suite() {
-        return new TestSuite(TransitionHandlerTest.class);
-    }
-
-    /**
-     * Test constructor.
-     *
-     * @param name the name of the test to run.
-     */
-    public TransitionHandlerTest(String name) {
-        super(name);
-    }
-
-    /**
-     * Setup the fixture.
-     */
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Teardown the fixture.
-     */
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
     /**
      * Method: constructor
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testConstructor() throws Exception {
 
         try {
             new TransitionHandler(null, new WarningSet());
-            fail("Should have thrown IllegalArgumentException");
+            Assert.fail("Should have thrown IllegalArgumentException");
         }
         catch (IllegalArgumentException iae) {
             //success
@@ -87,8 +45,9 @@ public class TransitionHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testOpenElement() throws Exception {
-        assertEquals(PlainTextHandler.INSTANCE, new TransitionHandler(new Stage(), new WarningSet()).openElement(null, null, null));
+        Assert.assertEquals(PlainTextHandler.INSTANCE, new TransitionHandler(new Stage(), new WarningSet()).openElement(null, null, null));
     }
 
     /**
@@ -96,6 +55,7 @@ public class TransitionHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testCloseElement() throws Exception {
 
         Stage stage = new Stage();
@@ -106,40 +66,40 @@ public class TransitionHandlerTest extends RocksimTestBase {
         Transition component = (Transition) getField(handler, "transition");
 
         handler.closeElement("ShapeCode", attributes, "0", warnings);
-        assertEquals(Transition.Shape.CONICAL, component.getType());
+        Assert.assertEquals(Transition.Shape.CONICAL, component.getType());
         handler.closeElement("ShapeCode", attributes, "1", warnings);
-        assertEquals(Transition.Shape.OGIVE, component.getType());
+        Assert.assertEquals(Transition.Shape.OGIVE, component.getType());
         handler.closeElement("ShapeCode", attributes, "17", warnings);
-        assertEquals(RocksimNoseConeCode.PARABOLIC.asOpenRocket(), component.getType());  //test of default
+        Assert.assertEquals(RocksimNoseConeCode.PARABOLIC.asOpenRocket(), component.getType());  //test of default
         handler.closeElement("ShapeCode", attributes, "foo", warnings);
-        assertNotNull(component.getType());
-        assertEquals(1, warnings.size());
+        Assert.assertNotNull(component.getType());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Len", attributes, "-1", warnings);
-        assertEquals(0d, component.getLength());
+        Assert.assertEquals(0d, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "10.0", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getLength(), 0.001);
         handler.closeElement("Len", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("FrontDia", attributes, "-1", warnings);
-        assertEquals(0d, component.getForeRadius());
+        Assert.assertEquals(0d, component.getForeRadius(), 0.001);
         handler.closeElement("FrontDia", attributes, "100", warnings);
-        assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getForeRadius());
+        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getForeRadius(), 0.001);
         handler.closeElement("FrontDia", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("RearDia", attributes, "-1", warnings);
-        assertEquals(0d, component.getAftRadius());
+        Assert.assertEquals(0d, component.getAftRadius(), 0.001);
         handler.closeElement("RearDia", attributes, "100", warnings);
-        assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftRadius());
+        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftRadius(), 0.001);
         handler.closeElement("RearDia", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         final double aft = 100d;
@@ -150,15 +110,15 @@ public class TransitionHandlerTest extends RocksimTestBase {
         component.setForeShoulderRadius(1.1d);
         handler.closeElement("WallThickness", attributes, "-1", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        assertEquals(component.getAftRadius(), component.getThickness());
-        assertEquals(component.getAftShoulderThickness(), component.getAftShoulderThickness());
-        assertEquals(component.getForeShoulderThickness(), component.getForeShoulderThickness());
+        Assert.assertEquals(component.getAftRadius(), component.getThickness(), 0.001);
+        Assert.assertEquals(component.getAftShoulderThickness(), component.getAftShoulderThickness(), 0.001);
+        Assert.assertEquals(component.getForeShoulderThickness(), component.getForeShoulderThickness(), 0.001);
         handler.closeElement("WallThickness", attributes, "100", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        assertEquals(aft, component.getThickness());
+        Assert.assertEquals(aft, component.getThickness(), 0.001);
         handler.closeElement("WallThickness", attributes, "foo", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
         
         handler.closeElement("ConstructionType", attributes, "1", warnings);
@@ -166,60 +126,60 @@ public class TransitionHandlerTest extends RocksimTestBase {
         component.setForeShoulderRadius(1.1d);
         handler.closeElement("WallThickness", attributes, "-1", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        assertEquals(0d, component.getThickness());
-        assertEquals(0d, component.getAftShoulderThickness());
-        assertEquals(0d, component.getForeShoulderThickness());
+        Assert.assertEquals(0d, component.getThickness(), 0.001);
+        Assert.assertEquals(0d, component.getAftShoulderThickness(), 0.001);
+        Assert.assertEquals(0d, component.getForeShoulderThickness(), 0.001);
         handler.closeElement("WallThickness", attributes, "1.1", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getThickness());
-        assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderThickness());
-        assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getForeShoulderThickness());
+        Assert.assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getThickness(), 0.001);
+        Assert.assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderThickness(), 0.001);
+        Assert.assertEquals(1.1d/RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getForeShoulderThickness(), 0.001);
         
 
         handler.closeElement("FrontShoulderLen", attributes, "-1", warnings);
-        assertEquals(0d, component.getForeShoulderLength());
+        Assert.assertEquals(0d, component.getForeShoulderLength(), 0.001);
         handler.closeElement("FrontShoulderLen", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getForeShoulderLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getForeShoulderLength(), 0.001);
         handler.closeElement("FrontShoulderLen", attributes, "10.0", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getForeShoulderLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getForeShoulderLength(), 0.001);
         handler.closeElement("FrontShoulderLen", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("RearShoulderLen", attributes, "-1", warnings);
-        assertEquals(0d, component.getAftShoulderLength());
+        Assert.assertEquals(0d, component.getAftShoulderLength(), 0.001);
         handler.closeElement("RearShoulderLen", attributes, "10", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength(), 0.001);
         handler.closeElement("RearShoulderLen", attributes, "10.0", warnings);
-        assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength());
+        Assert.assertEquals(10d / RocksimHandler.ROCKSIM_TO_OPENROCKET_LENGTH, component.getAftShoulderLength(), 0.001);
         handler.closeElement("RearShoulderLen", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("FrontShoulderDia", attributes, "-1", warnings);
-        assertEquals(0d, component.getForeShoulderRadius());
+        Assert.assertEquals(0d, component.getForeShoulderRadius(), 0.001);
         handler.closeElement("FrontShoulderDia", attributes, "100", warnings);
-        assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getForeShoulderRadius());
+        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getForeShoulderRadius(), 0.001);
         handler.closeElement("FrontShoulderDia", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("RearShoulderDia", attributes, "-1", warnings);
-        assertEquals(0d, component.getAftShoulderRadius());
+        Assert.assertEquals(0d, component.getAftShoulderRadius(), 0.001);
         handler.closeElement("RearShoulderDia", attributes, "100", warnings);
-        assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftShoulderRadius());
+        Assert.assertEquals(100d / RocksimHandler.ROCKSIM_TO_OPENROCKET_RADIUS, component.getAftShoulderRadius(), 0.001);
         handler.closeElement("RearShoulderDia", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         component.setType(Transition.Shape.HAACK);
         handler.closeElement("ShapeParameter", attributes, "-1", warnings);
-        assertEquals(0d, component.getShapeParameter());
+        Assert.assertEquals(0d, component.getShapeParameter(), 0.001);
         handler.closeElement("ShapeParameter", attributes, "100", warnings);
-        assertEquals(Transition.Shape.HAACK.maxParameter(), component.getShapeParameter());
+        Assert.assertEquals(Transition.Shape.HAACK.maxParameter(), component.getShapeParameter(), 0.001);
         handler.closeElement("ShapeParameter", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
-        assertEquals("Could not convert ShapeParameter value of foo.  It is expected to be a number.", 
+        Assert.assertEquals(1, warnings.size());
+        Assert.assertEquals("Could not convert ShapeParameter value of foo.  It is expected to be a number.", 
                      warnings.iterator().next().toString());
 
         warnings.clear();
@@ -227,22 +187,22 @@ public class TransitionHandlerTest extends RocksimTestBase {
         component.setType(Transition.Shape.CONICAL);
         component.setShapeParameter(0d);
         handler.closeElement("ShapeParameter", attributes, "100", warnings);
-        assertEquals(0d, component.getShapeParameter());
+        Assert.assertEquals(0d, component.getShapeParameter(), 0.001);
 
         handler.closeElement("FinishCode", attributes, "-1", warnings);
-        assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
+        Assert.assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
         handler.closeElement("FinishCode", attributes, "100", warnings);
-        assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
+        Assert.assertEquals(ExternalComponent.Finish.NORMAL, component.getFinish());
         handler.closeElement("FinishCode", attributes, "foo", warnings);
-        assertEquals(1, warnings.size());
+        Assert.assertEquals(1, warnings.size());
         warnings.clear();
 
         handler.closeElement("Name", attributes, "Test Name", warnings);
-        assertEquals("Test Name", component.getName());
+        Assert.assertEquals("Test Name", component.getName());
         
         handler.closeElement("Material", attributes, "Some Material", warnings);
         handler.endHandler("Transition", attributes, null, warnings);
-        assertTrue(component.getMaterial().getName().contains("Some Material"));
+        Assert.assertTrue(component.getMaterial().getName().contains("Some Material"));
     }
 
     /**
@@ -250,8 +210,9 @@ public class TransitionHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetComponent() throws Exception {
-        assertTrue(new TransitionHandler(new Stage(), new WarningSet()).getComponent() instanceof Transition);
+        Assert.assertTrue(new TransitionHandler(new Stage(), new WarningSet()).getComponent() instanceof Transition);
     }
 
     /**
@@ -259,8 +220,9 @@ public class TransitionHandlerTest extends RocksimTestBase {
      *
      * @throws Exception thrown if something goes awry
      */
+    @org.junit.Test
     public void testGetMaterialType() throws Exception {
-        assertEquals(Material.Type.BULK, new TransitionHandler(new Stage(), new WarningSet()).getMaterialType());
+        Assert.assertEquals(Material.Type.BULK, new TransitionHandler(new Stage(), new WarningSet()).getMaterialType());
     }