예제 #1
0
  // The two following tests a really unit tests, but since the whole uses
  // CCMBridge.PerClassSingleNodeCluster, they'll still spawn a cluster even
  // you execute only them, so we keep them in the "long" group. We could
  // move them in another class but not sure where honestly (one could argue
  // that it would make more sense to move all the *other* tests to some
  // DataTypeIntegrationTest class).
  @Test(groups = "long")
  public void serializeDeserializeTest() {

    for (DataType dt : DataType.allPrimitiveTypes()) {
      if (exclude(dt)) continue;

      Object value = TestUtils.getFixedValue(dt);
      assertEquals(dt.deserialize(dt.serialize(value)), value);
    }

    try {
      DataType.bigint().serialize(4);
      fail("This should not have worked");
    } catch (InvalidTypeException e) {
      /* That's what we want */
    }

    try {
      ByteBuffer badValue = ByteBuffer.allocate(4);
      DataType.bigint().deserialize(badValue);
      fail("This should not have worked");
    } catch (InvalidTypeException e) {
      /* That's what we want */
    }
  }