1 package net.sf.openrocket.preset;
3 import net.sf.openrocket.motor.Manufacturer;
8 * Test construction of STREAMER 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 StreamerPresetTests {
19 public void testManufacturerRequired() {
21 TypedPropertyMap presetspec = new TypedPropertyMap();
22 presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.STREAMER);
23 ComponentPresetFactory.create(presetspec);
24 } catch ( InvalidComponentPresetException ex ) {
25 PresetAssertHelper.assertInvalidPresetException( ex,
27 ComponentPreset.MANUFACTURER,
28 ComponentPreset.PARTNO,
29 ComponentPreset.LENGTH,
33 "No Manufacturer specified",
34 "No PartNo specified",
35 "No Length specified",
43 public void testPartNoRequired() {
45 TypedPropertyMap presetspec = new TypedPropertyMap();
46 presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.STREAMER);
47 presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
48 ComponentPresetFactory.create(presetspec);
49 } catch ( InvalidComponentPresetException ex ) {
50 PresetAssertHelper.assertInvalidPresetException( ex,
52 ComponentPreset.PARTNO,
53 ComponentPreset.LENGTH,
57 "No PartNo specified",
58 "No Length specified",
66 public void testLengthRequired() {
68 TypedPropertyMap presetspec = new TypedPropertyMap();
69 presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.STREAMER);
70 presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
71 presetspec.put( ComponentPreset.PARTNO, "partno");
72 ComponentPresetFactory.create(presetspec);
73 } catch ( InvalidComponentPresetException ex ) {
74 PresetAssertHelper.assertInvalidPresetException( ex,
76 ComponentPreset.LENGTH,
80 "No Length specified",
88 public void testWidthRequired() {
90 TypedPropertyMap presetspec = new TypedPropertyMap();
91 presetspec.put(ComponentPreset.TYPE, ComponentPreset.Type.STREAMER);
92 presetspec.put( ComponentPreset.MANUFACTURER, Manufacturer.getManufacturer("manufacturer"));
93 presetspec.put( ComponentPreset.PARTNO, "partno");
94 presetspec.put( ComponentPreset.LENGTH, 2.0);
95 ComponentPresetFactory.create(presetspec);
96 } catch ( InvalidComponentPresetException ex ) {
97 PresetAssertHelper.assertInvalidPresetException( ex,