### Question:
Group extends DynamicModel { public CloudInstance getReferenceInstanceConfiguration() { if (instances.isEmpty()) { return skeleton.orElseThrow(() -> new RuntimeException(String.format("There is no skeleton and instance available for Group -> name:%s", name))); } return instances.get(0); } Group(String name, InstanceGroupType type, Collection<CloudInstance> instances, Security security, CloudInstance skeleton,
            InstanceAuthentication instanceAuthentication, String loginUserName, String publicKey,
            int rootVolumeSize, Optional<CloudFileSystemView> identity);  Group(String name, InstanceGroupType type, Collection<CloudInstance> instances, Security security, CloudInstance skeleton,
            Map<String, Object> parameters, InstanceAuthentication instanceAuthentication, String loginUserName,
            String publicKey, int rootVolumeSize, Optional<CloudFileSystemView> identity); CloudInstance getReferenceInstanceConfiguration(); InstanceTemplate getReferenceInstanceTemplate(); String getName(); InstanceGroupType getType(); List<CloudInstance> getInstances(); Integer getInstancesSize(); Security getSecurity(); String getPublicKey(); String getLoginUserName(); InstanceAuthentication getInstanceAuthentication(); int getRootVolumeSize(); Optional<CloudFileSystemView> getIdentity(); @Override String toString();  }### Answer:
@Test void getReferenceInstanceConfigurationTestWhenNoInstancesAndValidSkeleton() { CloudInstance cloudInstance = createCloudInstance(); Group group = createGroup(emptyList(), cloudInstance); CloudInstance result = group.getReferenceInstanceConfiguration(); assertThat(result).isSameAs(cloudInstance); }
@Test void getReferenceInstanceConfigurationTestWhenSingleInstanceAndSkeletonIsNull() { CloudInstance cloudInstance = createCloudInstance(); Group group = createGroup(List.of(cloudInstance), null); CloudInstance result = group.getReferenceInstanceConfiguration(); assertThat(result).isSameAs(cloudInstance); }
@Test void getReferenceInstanceConfigurationTestWhenSingleInstanceAndValidSkeleton() { CloudInstance cloudInstance = createCloudInstance(); Group group = createGroup(List.of(cloudInstance), createCloudInstance()); CloudInstance result = group.getReferenceInstanceConfiguration(); assertThat(result).isSameAs(cloudInstance); }
@Test void getReferenceInstanceConfigurationTestWhenMultipleInstances() { CloudInstance cloudInstanceFirst = createCloudInstance(); Group group = createGroup(List.of(cloudInstanceFirst, createCloudInstance()), null); CloudInstance result = group.getReferenceInstanceConfiguration(); assertThat(result).isSameAs(cloudInstanceFirst); }