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;
import net.sf.openrocket.rocketcomponent.Transition;
presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.NOSE_CONE);
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
- assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No Manufacturer specified"));
+ PresetTest.assertInvalidPresetException( ex,
+ new TypedKey<?>[] {
+ ComponentPreset.MANUFACTURER,
+ ComponentPreset.PARTNO,
+ ComponentPreset.LENGTH,
+ ComponentPreset.AFT_OUTER_DIAMETER,
+ ComponentPreset.SHAPE
+ },
+ new String[] {
+ "No Manufacturer specified",
+ "No PartNo specified",
+ "No Length specified",
+ "No AftOuterDiameter specified",
+ "No Shape specified"
+ }
+ );
}
}
presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
- assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No PartNo specified"));
+ PresetTest.assertInvalidPresetException( ex,
+ new TypedKey<?>[] {
+ ComponentPreset.PARTNO,
+ ComponentPreset.LENGTH,
+ ComponentPreset.AFT_OUTER_DIAMETER,
+ ComponentPreset.SHAPE
+ },
+ new String[] {
+ "No PartNo specified",
+ "No Length specified",
+ "No AftOuterDiameter specified",
+ "No Shape specified"
+ }
+ );
}
}
presetspec.put( ComponentPreset.PARTNO, "partno");
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
- assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No Length specified"));
+ PresetTest.assertInvalidPresetException( ex,
+ new TypedKey<?>[] {
+ ComponentPreset.LENGTH,
+ ComponentPreset.AFT_OUTER_DIAMETER,
+ ComponentPreset.SHAPE
+ },
+ new String[] {
+ "No Length specified",
+ "No AftOuterDiameter specified",
+ "No Shape specified"
+ }
+ );
}
}
presetspec.put( ComponentPreset.LENGTH, 2.0);
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
- assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No Shape"));
+ PresetTest.assertInvalidPresetException( ex,
+ new TypedKey<?>[] {
+ ComponentPreset.AFT_OUTER_DIAMETER,
+ ComponentPreset.SHAPE
+ },
+ new String[] {
+ "No AftOuterDiameter specified",
+ "No Shape specified"
+ }
+ );
}
}
presetspec.put( ComponentPreset.SHAPE, Transition.Shape.CONICAL);
ComponentPresetFactory.create(presetspec);
} catch ( InvalidComponentPresetException ex ) {
- assertTrue("Wrong Exception Thrown", ex.getMessage().contains("No AftOuterDiameter"));
+ PresetTest.assertInvalidPresetException( ex,
+ new TypedKey<?>[] {
+ ComponentPreset.AFT_OUTER_DIAMETER
+ },
+ new String[] {
+ "No AftOuterDiameter specified"
+ }
+ );
}
}