X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=core%2Ftest%2Fnet%2Fsf%2Fopenrocket%2Fpreset%2FBulkHeadPresetTests.java;h=9f54ae953fff41549ef5f51ec73c695732800dad;hb=4da92a4e994992a78d62a7ca21c88d6c41292d6f;hp=047fe1395742dc51a4e4f767a1bc0f9230a6a806;hpb=d6033007b43b6969696d419f0c8d5b279136f430;p=debian%2Fopenrocket diff --git a/core/test/net/sf/openrocket/preset/BulkHeadPresetTests.java b/core/test/net/sf/openrocket/preset/BulkHeadPresetTests.java index 047fe139..9f54ae95 100644 --- a/core/test/net/sf/openrocket/preset/BulkHeadPresetTests.java +++ b/core/test/net/sf/openrocket/preset/BulkHeadPresetTests.java @@ -1,7 +1,6 @@ package net.sf.openrocket.preset; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import net.sf.openrocket.material.Material; import net.sf.openrocket.motor.Manufacturer; @@ -25,7 +24,20 @@ public class BulkHeadPresetTests { presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.BULK_HEAD); ComponentPresetFactory.create(presetspec); } catch ( InvalidComponentPresetException ex ) { - assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No Manufacturer specified")); + PresetAssertHelper.assertInvalidPresetException( ex, + new TypedKey[] { + ComponentPreset.MANUFACTURER, + ComponentPreset.PARTNO, + ComponentPreset.LENGTH, + ComponentPreset.OUTER_DIAMETER + }, + new String[] { + "No Manufacturer specified", + "No PartNo specified", + "No Length specified", + "No OuterDiameter specified" + } + ); } } @@ -37,7 +49,18 @@ public class BulkHeadPresetTests { presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer")); ComponentPresetFactory.create(presetspec); } catch ( InvalidComponentPresetException ex ) { - assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No PartNo specified")); + PresetAssertHelper.assertInvalidPresetException( ex, + new TypedKey[] { + ComponentPreset.PARTNO, + ComponentPreset.LENGTH, + ComponentPreset.OUTER_DIAMETER + }, + new String[] { + "No PartNo specified", + "No Length specified", + "No OuterDiameter specified" + } + ); } } @@ -50,7 +73,16 @@ public class BulkHeadPresetTests { presetspec.put( ComponentPreset.PARTNO, "partno"); ComponentPresetFactory.create(presetspec); } catch ( InvalidComponentPresetException ex ) { - assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No Length specified")); + PresetAssertHelper.assertInvalidPresetException( ex, + new TypedKey[] { + ComponentPreset.LENGTH, + ComponentPreset.OUTER_DIAMETER + }, + new String[] { + "No Length specified", + "No OuterDiameter specified" + } + ); } } @@ -64,7 +96,14 @@ public class BulkHeadPresetTests { presetspec.put( ComponentPreset.LENGTH, 2.0); ComponentPresetFactory.create(presetspec); } catch ( InvalidComponentPresetException ex ) { - assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No OuterDiameter specified")); + PresetAssertHelper.assertInvalidPresetException( ex, + new TypedKey[] { + ComponentPreset.OUTER_DIAMETER + }, + new String[] { + "No OuterDiameter specified" + } + ); } } @@ -99,7 +138,7 @@ public class BulkHeadPresetTests { presetspec.put( ComponentPreset.PARTNO, "partno"); presetspec.put( ComponentPreset.LENGTH, 2.0); presetspec.put( ComponentPreset.OUTER_DIAMETER, 2.0); - presetspec.put( ComponentPreset.MATERIAL, new Material.Bulk("test", 2.0, true)); + presetspec.put( ComponentPreset.MATERIAL, Material.newUserMaterial(Material.Type.BULK,"test", 2.0)); ComponentPreset preset = ComponentPresetFactory.create(presetspec); assertEquals("test",preset.get(ComponentPreset.MATERIAL).getName()); @@ -116,7 +155,7 @@ public class BulkHeadPresetTests { presetspec.put( ComponentPreset.LENGTH, 2.0); presetspec.put( ComponentPreset.OUTER_DIAMETER, 2.0); presetspec.put( ComponentPreset.MASS, 100.0); - presetspec.put( ComponentPreset.MATERIAL, new Material.Bulk("test", 2.0, true)); + presetspec.put( ComponentPreset.MATERIAL, Material.newUserMaterial(Material.Type.BULK,"test", 2.0)); ComponentPreset preset = ComponentPresetFactory.create(presetspec); // Compute the volume by hand here using a slightly different formula from