[88] | 1 | package com.framsticks.model.f0; |
---|
| 2 | |
---|
| 3 | import org.testng.annotations.*; |
---|
| 4 | |
---|
[90] | 5 | import com.framsticks.params.FramsClass; |
---|
[88] | 6 | import com.framsticks.params.types.FloatParam; |
---|
| 7 | import com.framsticks.test.TestConfiguration; |
---|
| 8 | import com.framsticks.model.f0.Schema; |
---|
| 9 | |
---|
| 10 | import static org.fest.assertions.Delta.*; |
---|
| 11 | |
---|
| 12 | import static org.fest.assertions.Assertions.*; |
---|
[105] | 13 | import static com.framsticks.params.ParamsUtil.getParam; |
---|
[88] | 14 | |
---|
| 15 | public class SchemaTest extends TestConfiguration { |
---|
| 16 | |
---|
| 17 | @Test |
---|
| 18 | public void loadSchemaWithXmlLoader() { |
---|
[90] | 19 | Schema schema = new SchemaBuilder().stream(Schema.getDefaultDefinitionAsStream()).finish(); |
---|
[88] | 20 | assertThat(schema.getFramsClasses().size()).isEqualTo(5); |
---|
| 21 | assertThat(schema.getNeuroClasses().size()).isEqualTo(21); |
---|
| 22 | |
---|
[97] | 23 | assertThat(schema.getFramsClass("m").getName()).isEqualTo("Model"); |
---|
| 24 | |
---|
[88] | 25 | assertThat(schema.getNeuroClass("|").getName()).isEqualTo("Bend muscle"); |
---|
[105] | 26 | assertThat(getParam(schema.getNeuroClass("VEye"), "p")).isInstanceOf(FloatParam.class); |
---|
| 27 | assertThat(getParam(schema.getNeuroClass("VEye"), "p", FloatParam.class).getMax(Double.class)).isEqualTo(10.0, delta(0.0)); |
---|
[88] | 28 | |
---|
[90] | 29 | FramsClass partClass = schema.getFramsClass("p"); |
---|
| 30 | assertThat(partClass).isNotNull(); |
---|
[105] | 31 | assertThat(getParam(partClass, "as", FloatParam.class).getDef(Double.class)).isEqualTo(0.25, delta(0.0)); |
---|
[90] | 32 | assertThat(partClass.getGroupCount()).isEqualTo(3); |
---|
| 33 | assertThat(partClass.getGroup(1).getName()).isEqualTo("Other properties"); |
---|
| 34 | assertThat(partClass.getGroup(1).getCount()).isEqualTo(7); |
---|
| 35 | assertThat(partClass.getGroup(1).getParam(2)).isEqualTo(partClass.getParam("dn")); |
---|
[88] | 36 | } |
---|
| 37 | |
---|
| 38 | } |
---|