/**
 * Copyright (C) 2015 Red Hat, Inc.
 * <p>
 * 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
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * 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 io.fabric8.crd.generator;

import static org.junit.jupiter.api.Assertions.assertEquals;

import io.fabric8.kubernetes.api.model.Namespaced;
import io.fabric8.kubernetes.client.CustomResource;
import io.fabric8.kubernetes.model.Scope;
import io.fabric8.kubernetes.model.annotation.Group;
import io.fabric8.kubernetes.model.annotation.Version;
import org.junit.jupiter.api.Test;

public class CustomResourceInfoTest {

  public static class Spec {

  }

  public static class Status {

  }

  private static final String GROUP = "sample.fabric8.io";
  private static final String VERSION = "v1";

  @Group(GROUP)
  @Version(VERSION)
  public static class ClusteredCR extends CustomResource<Spec, Status> {

  }

  @Group(GROUP)
  @Version(VERSION)
  public static class NamespacedCR extends CustomResource<Spec, Status> implements Namespaced {

  }

  @Test
  void shouldBeProperlyScoped() {
    CustomResourceInfo info = CustomResourceInfo.fromClass(ClusteredCR.class);
    assertEquals(GROUP, info.group());
    assertEquals(VERSION, info.version());
    assertEquals(Scope.CLUSTER, info.scope());

    info = CustomResourceInfo.fromClass(NamespacedCR.class);
    assertEquals(GROUP, info.group());
    assertEquals(VERSION, info.version());
    assertEquals(Scope.NAMESPACED, info.scope());
  }
}

@@ -689,16 +689,21 @@
 sert
+Array
 Equals;%0A
 %0Aimp
@@ -698,16 +698,129 @@
 Equals;%0A
+import static org.junit.jupiter.api.Assertions.assertEquals;%0A%0Aimport io.fabric8.kubernetes.api.model.HasMetadata;
 %0Aimport 
@@ -1010,16 +1010,74 @@
 .Group;%0A
+import io.fabric8.kubernetes.model.annotation.ShortNames;%0A
 import i
@@ -1404,32 +1404,51 @@
 ersion(VERSION)%0A
+  @ShortNames(%22s%22)%0A
   public static 
@@ -2095,11 +2095,1039 @@
 ());%0A  %7D
+%0A%0A  @Test%0A  void shouldProperlyCreateCustomResourceInfo() %7B%0A    CustomResourceInfo info = CustomResourceInfo.fromClass(ClusteredCR.class);%0A    assertEquals(GROUP, info.group());%0A    assertEquals(VERSION, info.version());%0A    assertEquals(Scope.CLUSTER, info.scope());%0A    assertEquals(ClusteredCR.class.getCanonicalName(), info.crClassName()); // todo: should we actually use the type name here?%0A    assertEquals(Spec.class.getTypeName(), info.specClassName().get());%0A    assertEquals(Status.class.getTypeName(), info.statusClassName().get());%0A    assertEquals(CustomResource.getSingular(ClusteredCR.class), info.singular());%0A    assertEquals(CustomResource.getPlural(ClusteredCR.class), info.plural());%0A    assertEquals(CustomResource.getCRDName(ClusteredCR.class), info.crdName());%0A    assertArrayEquals(CustomResource.getShortNames(ClusteredCR.class), info.shortNames());%0A    assertEquals(true, info.served());%0A    assertEquals(true, info.storage());%0A    assertEquals(HasMetadata.getKind(ClusteredCR.class), info.kind());%0A  %7D
 %0A%7D%0A

add tests