"\"uplink\":100," +
"\"downlink\":100," +
"\"hosts\":[\"one1\",\"two2\"]," +
"\"racks\":[\"three3\"]" +
"}";
final ResourceSpecification expected =
new DefaultResourceSpecification(2, 1024, 2, 100, 100,
Arrays.asList("one1", "two2"), Arrays.asList("three3"));
final String actualString = gson.toJson(expected);
Assert.assertEquals(expectedString, actualString);
final JsonElement expectedJson = gson.toJsonTree(expected);
final ResourceSpecification actual = gson.fromJson(expectedJson, DefaultResourceSpecification.class);
final JsonElement actualJson = gson.toJsonTree(actual);
Assert.assertEquals(expectedJson, actualJson);
ReflectionAssert.assertLenientEquals(expected, actual);
}