// 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;
/*
 * Copyright (c) 2015 Cloudera, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cloudera.director.spi.v2.util;





public class DisplayPropertiesUtilTest {

  @Test
  public void testAsDisplayPropertyList() {
    final DisplayProperty display1 = makeDisplayProperty("displayKey1", "displayDesc1");
    final DisplayProperty display2 = makeDisplayProperty("displayKey2", "displayDesc2");
    List<DisplayProperty> displayProperties = Arrays.asList(display1, display2);
    List<DisplayPropertyToken> displayPropertyTokens = Arrays.asList(
        new DisplayPropertyToken() {
          @Override
          public DisplayProperty unwrap() {
            return display1;
          }
        },
        new DisplayPropertyToken() {
          @Override
          public DisplayProperty unwrap() {
            return display2;
          }
        }
    );
    assertThat(DisplayPropertiesUtil.asDisplayPropertyList(
        displayPropertyTokens.toArray(new DisplayPropertyToken[2]))).isEqualTo(displayProperties);
  }

  @Test
  public void testMerge() {
// 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;

/*
 * Copyright (c) 2015 Cloudera, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cloudera.director.spi.v2.util;





public class DisplayPropertiesUtilTest {

  @Test
  public void testAsDisplayPropertyList() {
    final DisplayProperty display1 = makeDisplayProperty("displayKey1", "displayDesc1");
    final DisplayProperty display2 = makeDisplayProperty("displayKey2", "displayDesc2");
    List<DisplayProperty> displayProperties = Arrays.asList(display1, display2);
    List<DisplayPropertyToken> displayPropertyTokens = Arrays.asList(
        new DisplayPropertyToken() {
          @Override
          public DisplayProperty unwrap() {
            return display1;
          }
        },
        new DisplayPropertyToken() {
          @Override
          public DisplayProperty unwrap() {
            return display2;
          }
        }
    );
    assertThat(DisplayPropertiesUtil.asDisplayPropertyList(
        displayPropertyTokens.toArray(new DisplayPropertyToken[2]))).isEqualTo(displayProperties);
  }

  @Test
  public void testMerge() {
    DisplayProperty display1 = makeDisplayProperty("displayKey1", "displayDesc1");