// Path: src/main/java/com/cloudera/director/spi/v2/model/DisplayProperty.java
// public interface DisplayProperty extends Property<DisplayProperty.Widget> {
// 
//   /**
//    * Represents the widget used to display a property.
//    */
//   enum Widget {
// 
//     /**
//      * Radio button widget.
//      */
//     RADIO,
// 
//     /**
//      * Checkbox widget.
//      */
//     CHECKBOX,
// 
//     /**
//      * Text box widget.
//      */
//     TEXT,
// 
//     /**
//      * Text area widget.
//      */
//     TEXTAREA,
// 
//     /**
//      * File download widget.
//      */
//     FILE,
// 
//     /**
//      * Multiple display widget for a fixed set of values.
//      */
//     MULTI
//   }
// 
//   /**
//    * Returns the display key.
//    *
//    * @return the display key
//    */
//   String getDisplayKey();
// }
// 
// Path: src/main/java/com/cloudera/director/spi/v2/model/DisplayPropertyToken.java
// public interface DisplayPropertyToken {
// 
//   /**
//    * Returns the display property.
//    *
//    * @return the display property
//    */
//   DisplayProperty unwrap();
// }
// 
// Path: src/main/java/com/cloudera/director/spi/v2/model/util/SimpleDisplayPropertyBuilder.java
// public class SimpleDisplayPropertyBuilder extends AbstractDisplayPropertyBuilder
//     <SimpleDisplayProperty, SimpleDisplayPropertyBuilder> {
// 
//   @Override
//   public SimpleDisplayPropertyBuilder getThis() {
//     return this;
//   }
// 
//   @Override
//   public SimpleDisplayProperty build() {
//     return new SimpleDisplayProperty(getDisplayKey(), getType(), getName(), getWidget(),
//         getDefaultDescription(), isSensitive(), isHidden());
//   }
// }


import static org.assertj.core.api.Assertions.assertThat;
import com.cloudera.director.spi.v2.model.DisplayProperty;
import com.cloudera.director.spi.v2.model.DisplayPropertyToken;
import com.cloudera.director.spi.v2.model.util.SimpleDisplayPropertyBuilder;
import java.util.Arrays;
import java.util.List;
import org.assertj.core.util.Lists;
import org.junit.Test;
  public void testMerge() {
    DisplayProperty display1 = makeDisplayProperty("displayKey1", "displayDesc1");
    DisplayProperty display2 = makeDisplayProperty("displayKey2", "displayDesc2");
    DisplayProperty display3 = makeDisplayProperty("displayKey3", "displayDesc3");

    DisplayProperty display4 = makeDisplayProperty("displayKey4", "displayDesc4");
    DisplayProperty display5 = makeDisplayProperty("displayKey5", "displayDesc5");
    DisplayProperty display6 = makeDisplayProperty("displayKey6", "displayDesc6");

    assertThat(
        DisplayPropertiesUtil.merge(Lists.newArrayList(display1, display2, display3),
            Lists.newArrayList(display4, display5, display6)))
        .containsOnly(display1, display2, display3, display4, display5, display6);
  }

  @Test
  public void testMergeReplace() {
    DisplayProperty display1 = makeDisplayProperty("displayKey1", "displayDesc1");
    DisplayProperty display2 = makeDisplayProperty("displayKey2", "displayDesc2");
    DisplayProperty display3 = makeDisplayProperty("displayKey3", "displayDesc3");

    DisplayProperty display1b = makeDisplayProperty("displayKey1", "displayDesc3");

    assertThat(
        DisplayPropertiesUtil.merge(Lists.newArrayList(display1, display2),
            Lists.newArrayList(display1b, display3)))
        .containsOnly(display1b, display2, display3);
  }

  private DisplayProperty makeDisplayProperty(String displayKey, String description) {
// Path: src/main/java/com/cloudera/director/spi/v2/model/DisplayProperty.java
// public interface DisplayProperty extends Property<DisplayProperty.Widget> {
// 
//   /**
//    * Represents the widget used to display a property.
//    */
//   enum Widget {
// 
//     /**
//      * Radio button widget.
//      */
//     RADIO,
// 
//     /**
//      * Checkbox widget.
//      */
//     CHECKBOX,
// 
//     /**
//      * Text box widget.
//      */
//     TEXT,
// 
//     /**
//      * Text area widget.
//      */
//     TEXTAREA,
// 
//     /**
//      * File download widget.
//      */
//     FILE,
// 
//     /**
//      * Multiple display widget for a fixed set of values.
//      */
//     MULTI
//   }
// 
//   /**
//    * Returns the display key.
//    *
//    * @return the display key
//    */
//   String getDisplayKey();
// }
// 
// Path: src/main/java/com/cloudera/director/spi/v2/model/DisplayPropertyToken.java
// public interface DisplayPropertyToken {
// 
//   /**
//    * Returns the display property.
//    *
//    * @return the display property
//    */
//   DisplayProperty unwrap();
// }
// 
// Path: src/main/java/com/cloudera/director/spi/v2/model/util/SimpleDisplayPropertyBuilder.java
// public class SimpleDisplayPropertyBuilder extends AbstractDisplayPropertyBuilder
//     <SimpleDisplayProperty, SimpleDisplayPropertyBuilder> {
// 
//   @Override
//   public SimpleDisplayPropertyBuilder getThis() {
//     return this;
//   }
// 
//   @Override
//   public SimpleDisplayProperty build() {
//     return new SimpleDisplayProperty(getDisplayKey(), getType(), getName(), getWidget(),
//         getDefaultDescription(), isSensitive(), isHidden());
//   }
// }


// Path: src/test/java/com/cloudera/director/spi/v2/util/DisplayPropertiesUtilTest.java
import static org.assertj.core.api.Assertions.assertThat;
import com.cloudera.director.spi.v2.model.DisplayProperty;
import com.cloudera.director.spi.v2.model.DisplayPropertyToken;
import com.cloudera.director.spi.v2.model.util.SimpleDisplayPropertyBuilder;
import java.util.Arrays;
import java.util.List;
import org.assertj.core.util.Lists;
import org.junit.Test;

  public void testMerge() {
    DisplayProperty display1 = makeDisplayProperty("displayKey1", "displayDesc1");
    DisplayProperty display2 = makeDisplayProperty("displayKey2", "displayDesc2");
    DisplayProperty display3 = makeDisplayProperty("displayKey3", "displayDesc3");

    DisplayProperty display4 = makeDisplayProperty("displayKey4", "displayDesc4");
    DisplayProperty display5 = makeDisplayProperty("displayKey5", "displayDesc5");
    DisplayProperty display6 = makeDisplayProperty("displayKey6", "displayDesc6");

    assertThat(
        DisplayPropertiesUtil.merge(Lists.newArrayList(display1, display2, display3),
            Lists.newArrayList(display4, display5, display6)))
        .containsOnly(display1, display2, display3, display4, display5, display6);
  }

  @Test
  public void testMergeReplace() {
    DisplayProperty display1 = makeDisplayProperty("displayKey1", "displayDesc1");
    DisplayProperty display2 = makeDisplayProperty("displayKey2", "displayDesc2");
    DisplayProperty display3 = makeDisplayProperty("displayKey3", "displayDesc3");

    DisplayProperty display1b = makeDisplayProperty("displayKey1", "displayDesc3");

    assertThat(
        DisplayPropertiesUtil.merge(Lists.newArrayList(display1, display2),
            Lists.newArrayList(display1b, display3)))
        .containsOnly(display1b, display2, display3);
  }

  private DisplayProperty makeDisplayProperty(String displayKey, String description) {
    return new SimpleDisplayPropertyBuilder()