// create a new node, check labels, modify type, check labels again
try (final Tx tx = app.tx()) {
// create entity of type TestFour
final TestFour testEntity = createTestNode(TestFour.class);
// check if node exists
assertNotNull(testEntity);
// check labels before type change
assertTrue(labelsBefore.containsAll(Iterables.toSet(testEntity.getNode().getLabels())));
// save ID for later use
id = testEntity.getUuid();
// change type to TestFive
testEntity.setProperty(GraphObject.type, TestFive.class.getSimpleName());
// commit transaction
tx.success();
} catch (FrameworkException fex) {
fail("Unexpected exception");
}
try (final Tx tx = app.tx()) {
final TestFive testEntity = app.get(TestFive.class, id);
assertNotNull(testEntity);
// check labels after type change
assertTrue(labelsAfter.containsAll(Iterables.toSet(testEntity.getNode().getLabels())));
} catch (FrameworkException fex) {
fail("Unexpected exception");
}