use of com.linkedin.restli.client.util.test.PatchTreeTestModel in project rest.li by linkedin.
the class TestPatchTreeRecorder method testSetCoerceEnum.
@Test
public void testSetCoerceEnum() {
PatchTreeRecorder<PatchTreeTestModel> pc = makeOne();
pc.getRecordingProxy().setFooEnum(FooEnum.A);
Assert.assertEquals(pc.generatePatchTree().getDataMap(), diffEmpty(new PatchTreeTestModel().setFooEnum(FooEnum.A)));
}
use of com.linkedin.restli.client.util.test.PatchTreeTestModel in project rest.li by linkedin.
the class TestPatchTreeRecorder method testSetBytes.
@Test
public void testSetBytes() {
PatchTreeRecorder<PatchTreeTestModel> pc = makeOne();
pc.getRecordingProxy().setFooByteString(ByteString.copyString("foo", "UTF-8"));
Assert.assertEquals(pc.generatePatchTree().getDataMap(), diffEmpty(new PatchTreeTestModel().setFooByteString(ByteString.copyString("foo", "UTF-8"))));
}
use of com.linkedin.restli.client.util.test.PatchTreeTestModel in project rest.li by linkedin.
the class TestPatchTreeRecorder method testSimpleSetIgnoreNullSetMode.
@Test
public void testSimpleSetIgnoreNullSetMode() {
PatchTreeRecorder<PatchTreeTestModel> pc = makeOne();
pc.getRecordingProxy().setFooRequired(100).setFooOptional(null, SetMode.IGNORE_NULL);
Assert.assertEquals(pc.generatePatchTree().getDataMap(), diffEmpty(new PatchTreeTestModel().setFooRequired(100)));
}
use of com.linkedin.restli.client.util.test.PatchTreeTestModel in project rest.li by linkedin.
the class TestPatchTreeRecorder method testSimpleSet.
@Test
public void testSimpleSet() {
PatchTreeRecorder<PatchTreeTestModel> pc = makeOne();
PatchTreeTestModel testModel = pc.getRecordingProxy();
testModel.setFooOptional(10l);
testModel.setFooRequired(20l);
Assert.assertEquals(pc.generatePatchTree().getDataMap(), diffEmpty(new PatchTreeTestModel().setFooOptional(10l).setFooRequired(20l)));
}
use of com.linkedin.restli.client.util.test.PatchTreeTestModel 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))));
}
Aggregations