コード例 #1
0
  @Test
  public void scalarVariableReal_deserialize() {

    String jsonString_0 =
        "{\"t\":\"ScalarVariableReal\",\"n\":\"scalarVar name\",\"i\":1,\"c\":6,\"vb\":4,\"d\":\"The Description\",\"vr\":125420,\"typeSpecReal\":{\"t\":\"TypeSpecReal\",\"start\":20.25,\"nominal\":21.25,\"min\":22.25,\"max\":23.25,\"unit\":\"C\"}}";

    Object deserializedObject_0 = gsonController_.fromJson(jsonString_0);

    assertEquals(ScalarVariableReal.class, deserializedObject_0.getClass());
    ScalarVariableReal scalarVariableReal_0 = (ScalarVariableReal) deserializedObject_0;

    assertEquals(125420, scalarVariableReal_0.getValueReference());
    assertEquals(1, scalarVariableReal_0.getIdx());
    assertEquals("scalarVar name", scalarVariableReal_0.getName());

    assertEquals(6, scalarVariableReal_0.getCausalityAsInt());
    assertEquals(Enu.enu_input, scalarVariableReal_0.getCausalityAsEnum());

    assertEquals(4, scalarVariableReal_0.getVariabilityAsInt());
    assertEquals(Enu.enu_discrete, scalarVariableReal_0.getVariabilityAsEnum());

    assertEquals("The Description", scalarVariableReal_0.getDescription());

    TypeSpecReal typeSpecReal = scalarVariableReal_0.getTypeSpecReal();

    assertEquals(20.25, typeSpecReal.start, 0.0);
    assertEquals(21.25, typeSpecReal.nominal, 0.0);
    assertEquals(22.25, typeSpecReal.min, 0.0);
    assertEquals(23.25, typeSpecReal.max, 0.0);
    assertEquals("C", typeSpecReal.unit);
  }
コード例 #2
0
  @Test
  public void xmlParsedInfo_deserialize() {

    String jsonString_0 =
        "{\"t\":\"XMLparsedInfo\",\"scalarVariablesAll_\":{\"t\":\"ScalarVariablesAll\",\"input\":{\"t\":\"ScalarVariableCollection\",\"realVarList_\":[{\"t\":\"ScalarVariableReal\",\"n\":\"scalarVar name\",\"i\":1,\"c\":6,\"vb\":5,\"d\":\"The Description 1\",\"vr\":125420,\"typeSpecReal\":{\"t\":\"TypeSpecReal\",\"start\":20.25,\"nominal\":21.25,\"min\":22.25,\"max\":23.25,\"unit\":\"C\"}},{\"t\":\"ScalarVariableReal\",\"n\":\"scalarVar name\",\"i\":1,\"c\":6,\"vb\":4,\"d\":\"The Description\",\"vr\":125420,\"typeSpecReal\":{\"t\":\"TypeSpecReal\",\"start\":2.25,\"nominal\":2.25,\"min\":2.25,\"max\":2.25,\"unit\":\"Pa\"}}]},\"output\":{\"t\":\"ScalarVariableCollection\",\"realVarList_\":[{\"t\":\"ScalarVariableReal\",\"n\":\"scalarVar name\",\"i\":1,\"c\":6,\"vb\":5,\"d\":\"The Description 1\",\"vr\":125420,\"typeSpecReal\":{\"t\":\"TypeSpecReal\",\"start\":20.25,\"nominal\":21.25,\"min\":22.25,\"max\":23.25,\"unit\":\"C\"}},{\"t\":\"ScalarVariableReal\",\"n\":\"scalarVar name\",\"i\":1,\"c\":6,\"vb\":4,\"d\":\"The Description\",\"vr\":125420,\"typeSpecReal\":{\"t\":\"TypeSpecReal\",\"start\":2.25,\"nominal\":2.25,\"min\":2.25,\"max\":2.25,\"unit\":\"Pa\"}}]},\"internal\":{\"t\":\"ScalarVariableCollection\",\"realVarList_\":[{\"t\":\"ScalarVariableReal\",\"n\":\"scalarVar name\",\"i\":1,\"c\":6,\"vb\":5,\"d\":\"The Description 1\",\"vr\":125420,\"typeSpecReal\":{\"t\":\"TypeSpecReal\",\"start\":20.25,\"nominal\":21.25,\"min\":22.25,\"max\":23.25,\"unit\":\"C\"}},{\"t\":\"ScalarVariableReal\",\"n\":\"scalarVar name\",\"i\":1,\"c\":6,\"vb\":4,\"d\":\"The Description\",\"vr\":125420,\"typeSpecReal\":{\"t\":\"TypeSpecReal\",\"start\":2.25,\"nominal\":2.25,\"min\":2.25,\"max\":2.25,\"unit\":\"Pa\"}}]}},\"sessionID_\":\"xxo\"}";
    Object deserializedObject_0 = gsonController_.fromJson(jsonString_0);

    assertEquals(XMLparsedInfo.class, deserializedObject_0.getClass());
    XMLparsedInfo xmlParsedInfo_0 = (XMLparsedInfo) deserializedObject_0;

    Vector<ScalarVariableReal> scalarVariableRealList_input = xmlParsedInfo_0.getInputVariables();
    Vector<ScalarVariableReal> scalarVariableRealList_output = xmlParsedInfo_0.getOutputVariables();

    assertEquals(2, scalarVariableRealList_input.size());
    assertEquals(2, scalarVariableRealList_output.size());

    ScalarVariableReal scalarVariableReal_0 = scalarVariableRealList_input.elementAt(0);
    assertEquals(Enu.enu_input, scalarVariableReal_0.getCausalityAsEnum());
    assertEquals(6, scalarVariableReal_0.getCausalityAsInt());
    assertEquals("input", scalarVariableReal_0.getCausalityAsString());

    assertEquals("scalarVar name", scalarVariableReal_0.getName());
    assertEquals(1, scalarVariableReal_0.getIdx());

    assertEquals(Enu.enu_continuous, scalarVariableReal_0.getVariabilityAsEnum());
    assertEquals(5, scalarVariableReal_0.getVariabilityAsInt());
    assertEquals("continuous", scalarVariableReal_0.getVariabilityAsString());

    assertEquals("The Description 1", scalarVariableReal_0.getDescription());
    assertEquals("C", scalarVariableReal_0.getUnit());

    TypeSpecReal typeSpecReal_0 = scalarVariableReal_0.getTypeSpecReal();

    assertEquals(20.25, typeSpecReal_0.start, 0.0);
    assertEquals(21.25, typeSpecReal_0.nominal, 0.0);
    assertEquals(22.25, typeSpecReal_0.min, 0.0);
    assertEquals(23.25, typeSpecReal_0.max, 0.0);
    assertEquals("C", typeSpecReal_0.unit);

    return;
  }