1 package net.sf.openrocket.preset;
3 import net.sf.openrocket.motor.Manufacturer;
8 * Test construction of PARACHUTE type ComponentPresets based on TypedPropertyMap through the
9 * ComponentPresetFactory.create() method.
11 * Ensure required properties are populated
13 * Ensure any computed values are correctly computed.
16 public class ParachutePresetTests {
19 public void testManufacturerRequired() {
21 TypedPropertyMap presetspec = new TypedPropertyMap();
22 presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.PARACHUTE);
23 ComponentPresetFactory.create(presetspec);
24 } catch ( InvalidComponentPresetException ex ) {
25 PresetAssertHelper.assertInvalidPresetException( ex,
27 ComponentPreset.MANUFACTURER,
28 ComponentPreset.PARTNO,
29 ComponentPreset.DIAMETER,
30 ComponentPreset.LINE_COUNT,
31 ComponentPreset.LINE_LENGTH
34 "No Manufacturer specified",
35 "No PartNo specified",
36 "No Diameter specified",
37 "No LineCount specified",
38 "No LineLength specified"
45 public void testPartNoRequired() {
47 TypedPropertyMap presetspec = new TypedPropertyMap();
48 presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.PARACHUTE);
49 presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
50 ComponentPresetFactory.create(presetspec);
51 } catch ( InvalidComponentPresetException ex ) {
52 PresetAssertHelper.assertInvalidPresetException( ex,
54 ComponentPreset.PARTNO,
55 ComponentPreset.DIAMETER,
56 ComponentPreset.LINE_COUNT,
57 ComponentPreset.LINE_LENGTH
60 "No PartNo specified",
61 "No Diameter specified",
62 "No LineCount specified",
63 "No LineLength specified"
70 public void testDiameterRequired() {
72 TypedPropertyMap presetspec = new TypedPropertyMap();
73 presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.PARACHUTE);
74 presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
75 presetspec.put( ComponentPreset.PARTNO, "partno");
76 ComponentPresetFactory.create(presetspec);
77 } catch ( InvalidComponentPresetException ex ) {
78 PresetAssertHelper.assertInvalidPresetException( ex,
80 ComponentPreset.DIAMETER,
81 ComponentPreset.LINE_COUNT,
82 ComponentPreset.LINE_LENGTH
85 "No Diameter specified",
86 "No LineCount specified",
87 "No LineLength specified"
94 public void testLineCountRequired() {
96 TypedPropertyMap presetspec = new TypedPropertyMap();
97 presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.PARACHUTE);
98 presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
99 presetspec.put( ComponentPreset.PARTNO, "partno");
100 presetspec.put( ComponentPreset.DIAMETER, 2.0);
101 ComponentPresetFactory.create(presetspec);
102 } catch ( InvalidComponentPresetException ex ) {
103 PresetAssertHelper.assertInvalidPresetException( ex,
105 ComponentPreset.LINE_COUNT,
106 ComponentPreset.LINE_LENGTH
109 "No LineCount specified",
110 "No LineLength specified"
117 public void testLineLengthRequired() {
119 TypedPropertyMap presetspec = new TypedPropertyMap();
120 presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.PARACHUTE);
121 presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
122 presetspec.put( ComponentPreset.PARTNO, "partno");
123 presetspec.put( ComponentPreset.DIAMETER, 2.0);
124 presetspec.put( ComponentPreset.LINE_COUNT, 6);
125 ComponentPresetFactory.create(presetspec);
126 } catch ( InvalidComponentPresetException ex ) {
127 PresetAssertHelper.assertInvalidPresetException( ex,
129 ComponentPreset.LINE_LENGTH
132 "No LineLength specified"