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

    String jsonString_0 =
        "{\"t\":\"ScalarValueResults\",\"time_\":2.0,\"input\":{\"t\":\"ScalarValueCollection\",\"realList\":[{\"t\":\"ScalarValueReal\",\"i\":1,\"v\":2.0},{\"t\":\"ScalarValueReal\",\"i\":2,\"v\":3.53}],\"booleanList\":[{\"t\":\"ScalarValueBoolean\",\"i\":1,\"v\":true},{\"t\":\"ScalarValueBoolean\",\"i\":0,\"v\":false}]},\"output\":{\"t\":\"ScalarValueCollection\",\"realList\":[{\"t\":\"ScalarValueReal\",\"i\":1,\"v\":2.0},{\"t\":\"ScalarValueReal\",\"i\":2,\"v\":3.53}],\"booleanList\":[{\"t\":\"ScalarValueBoolean\",\"i\":1,\"v\":true},{\"t\":\"ScalarValueBoolean\",\"i\":0,\"v\":false}]}}";

    Object deserializedObject_0 = gsonController_.fromJson(jsonString_0);

    assertEquals(ScalarValueResults.class, deserializedObject_0.getClass());

    ScalarValueResults scalarValueResults_0 = (ScalarValueResults) deserializedObject_0;

    assertEquals(2.0, scalarValueResults_0.getTime(), 0.0);

    ScalarValueReal scalarValueReal_0 = scalarValueResults_0.getInput().getRealList().get(0);
    assertEquals(1, scalarValueReal_0.getIdx());
    assertEquals(2.0, scalarValueReal_0.getValue(), 0.0);

    ScalarValueReal scalarValueReal_1 = scalarValueResults_0.getInput().getRealList().get(1);
    assertEquals(2, scalarValueReal_1.getIdx());
    assertEquals(3.530, scalarValueReal_1.getValue(), 0.0);

    ScalarValueReal scalarValueReal_2 = scalarValueResults_0.getOutput().getRealList().get(0);
    assertEquals(1, scalarValueReal_2.getIdx());
    assertEquals(2.0, scalarValueReal_2.getValue(), 0.0);

    ScalarValueReal scalarValueReal_3 = scalarValueResults_0.getOutput().getRealList().get(1);
    assertEquals(2, scalarValueReal_3.getIdx());
    assertEquals(3.530, scalarValueReal_3.getValue(), 0.0);
  }
コード例 #2
0
  @Test
  public void scalarValueCollection_deserialize() {
    String jsonString_0 =
        "{\"t\":\"ScalarValueCollection\",\"realList\":[{\"t\":\"ScalarValueReal\",\"i\":1,\"v\":2.0},{\"t\":\"ScalarValueReal\",\"i\":2,\"v\":3.53}],\"booleanList\":[{\"t\":\"ScalarValueBoolean\",\"i\":1,\"v\":true},{\"t\":\"ScalarValueBoolean\",\"i\":2,\"v\":false}]}";
    Object deserializedObject_0 = gsonController_.fromJson(jsonString_0);

    assertEquals(ScalarValueCollection.class, deserializedObject_0.getClass());
    ScalarValueCollection scalarValueCollection_0 = (ScalarValueCollection) deserializedObject_0;

    Vector<ScalarValueReal> realList = scalarValueCollection_0.getRealList();

    ScalarValueReal scalarValueReal_0 = realList.get(0);
    assertEquals(1, scalarValueReal_0.getIdx());
    assertEquals(2.0, scalarValueReal_0.getValue(), 0.0);

    ScalarValueReal scalarValueReal_1 = realList.get(1);
    assertEquals(2, scalarValueReal_1.getIdx());
    assertEquals(3.53, scalarValueReal_1.getValue(), 0.0);

    //		Vector<ScalarValueBoolean> boolList = scalarValueCollection_0.getBooleanList();
    //
    //		ScalarValueBoolean scalarValueBoolean_0 = boolList.get(0);
    //		assertEquals(1, scalarValueBoolean_0.getIdx());
    //		assertEquals(false, scalarValueBoolean_0.getValue());
    //
    //		ScalarValueBoolean scalarValueBoolean_1 = boolList.get(1);
    //		assertEquals(2, scalarValueBoolean_1.getIdx());
    //		assertEquals(false, scalarValueBoolean_1.getValue());

  }
コード例 #3
0
  @Test
  public void scalarValueReal_deserialize() {

    String jsonString = "{\"t\":\"ScalarValueReal\",\"i\":1,\"v\":2.0}";

    Object deserializedObject = gsonController_.fromJson(jsonString);

    assertEquals(ScalarValueReal.class, deserializedObject.getClass());
    ScalarValueReal scalarValueReal = (ScalarValueReal) deserializedObject;

    assertEquals(1, scalarValueReal.getIdx());
    assertEquals(2.0, scalarValueReal.getValue(), 0.0);
  }