Search in sources :

Example 1 with FooRecordTemplate

use of com.linkedin.restli.client.util.test.FooRecordTemplate in project rest.li by linkedin.

the class TestPatchTreeRecorder method testSetRecordTemplate.

@Test
public void testSetRecordTemplate() {
    PatchTreeRecorder<PatchTreeTestModel> pc = makeOne();
    pc.getRecordingProxy().setFooRecordTemplate(new FooRecordTemplate().setBar(20));
    PatchTreeTestModel expectModel = new PatchTreeTestModel().setFooRecordTemplate(new FooRecordTemplate().setBar(20));
    Assert.assertEquals(pc.generatePatchTree().getDataMap(), diffEmpty(expectModel));
}
Also used : FooRecordTemplate(com.linkedin.restli.client.util.test.FooRecordTemplate) PatchTreeTestModel(com.linkedin.restli.client.util.test.PatchTreeTestModel) Test(org.testng.annotations.Test)

Example 2 with FooRecordTemplate

use of com.linkedin.restli.client.util.test.FooRecordTemplate in project rest.li by linkedin.

the class TestPatchTreeRecorder method testPatchGeneratesDeepCopiesOfInternalState.

@Test
public void testPatchGeneratesDeepCopiesOfInternalState() {
    PatchTreeRecorder<PatchTreeTestModel> pc = makeOne();
    PatchTreeTestModel restCommonTestModel = pc.getRecordingProxy();
    restCommonTestModel.setFooRecordTemplate(new FooRecordTemplate().setBar(10l));
    PatchTree pt1 = pc.generatePatchTree();
    restCommonTestModel.setFooRecordTemplate(new FooRecordTemplate().setBar(20l));
    PatchTree pt2 = pc.generatePatchTree();
    Assert.assertNotEquals(pt1.getDataMap(), pt2.getDataMap());
    Assert.assertEquals(pt1.getDataMap(), diffEmpty(new PatchTreeTestModel().setFooRecordTemplate(new FooRecordTemplate().setBar(10l))));
    Assert.assertEquals(pt2.getDataMap(), diffEmpty(new PatchTreeTestModel().setFooRecordTemplate(new FooRecordTemplate().setBar(20l))));
}
Also used : FooRecordTemplate(com.linkedin.restli.client.util.test.FooRecordTemplate) PatchTreeTestModel(com.linkedin.restli.client.util.test.PatchTreeTestModel) PatchTree(com.linkedin.data.transform.patch.request.PatchTree) Test(org.testng.annotations.Test)

Aggregations

FooRecordTemplate (com.linkedin.restli.client.util.test.FooRecordTemplate)2 PatchTreeTestModel (com.linkedin.restli.client.util.test.PatchTreeTestModel)2 Test (org.testng.annotations.Test)2 PatchTree (com.linkedin.data.transform.patch.request.PatchTree)1