Examples of PatchTreeTestModel


Examples of com.linkedin.data.transform.test.PatchTreeTestModel

  @Test
  public void testSimpleSetRemoveOptionalIfNullOnOptionalFieldPass()
  {
    PatchTreeRecorder<PatchTreeTestModel> pc = makeOne();
    PatchTreeTestModel restCommonTestModel = pc.getRecordingProxy();

    restCommonTestModel.setFooOptional(null, SetMode.REMOVE_OPTIONAL_IF_NULL);
    // Augment the patch request with the removes
    PatchTree ptExpect = new PatchTree();
    ptExpect.addOperation(PatchTreeTestModel.fields().fooOptional(), new RemoveFieldOp());

    Assert.assertEquals(pc.generatePatchTree().getDataMap(),
View Full Code Here

Examples of com.linkedin.data.transform.test.PatchTreeTestModel

  @Test
  public void testFluentSet()
  {
    PatchTreeRecorder<PatchTreeTestModel> pc = makeOne();
    PatchTreeTestModel testModel = pc.getRecordingProxy();

    testModel.setFooOptional(100).setFooEnum(FooEnum.B);

    Assert.assertEquals(pc.generatePatchTree().getDataMap(),
                        diffEmpty(new PatchTreeTestModel().setFooOptional(100).setFooEnum(FooEnum.B)));
  }
View Full Code Here

Examples of com.linkedin.data.transform.test.PatchTreeTestModel

  @Test
  public void testFluentSetWithRemove()
  {
    PatchTreeRecorder<PatchTreeTestModel> pc = makeOne();
    PatchTreeTestModel testModel = pc.getRecordingProxy();

    PatchTreeTestModel.FooUnion fooUnion = new PatchTreeTestModel.FooUnion();
    fooUnion.setInt(10);
    testModel.setFooRequired(100).setFooUnion(fooUnion).setFooRecordTemplate(null, SetMode.REMOVE_IF_NULL).removeFooOptional();

    PatchTree ptExpect = PatchCreator.diff(new DataMap(),
                                           new PatchTreeTestModel().setFooRequired(100).setFooUnion(fooUnion).data());
    // Augment the patch request with the removes
    ptExpect.addOperation(PatchTreeTestModel.fields().fooRecordTemplate(), new RemoveFieldOp());
    ptExpect.addOperation(PatchTreeTestModel.fields().fooOptional(), new RemoveFieldOp());

    Assert.assertEquals(pc.generatePatchTree().getDataMap(), ptExpect.getDataMap());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.