-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add test to show type inference issue
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/TypeInferenceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package io.fabric8.kubernetes.client; | ||
|
||
import io.fabric8.kubernetes.api.model.ConfigMap; | ||
import io.fabric8.kubernetes.api.model.HasMetadata; | ||
import io.fabric8.kubernetes.api.model.Service; | ||
import io.fabric8.kubernetes.api.model.apps.Deployment; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Arrays; | ||
import java.util.Optional; | ||
|
||
class TypeInferenceTest { | ||
|
||
@Test | ||
void test() { | ||
final ConfigMapDependentResource cdr = new ConfigMapDependentResource(); | ||
final DeploymentDependentResource ddr = new DeploymentDependentResource(); | ||
Arrays.asList(cdr, ddr).forEach(dr -> dr.reconcile()); | ||
} | ||
|
||
static abstract class KubernetesDependentResource<R extends HasMetadata, P extends HasMetadata> | ||
implements DependentResourceConfigurator<KubernetesDependentConfig<R>> { | ||
void reconcile() { | ||
// NOOP | ||
} | ||
|
||
@Override | ||
public void configureWith(KubernetesDependentConfig<R> config) { | ||
|
||
} | ||
|
||
@Override | ||
public Optional<KubernetesDependentConfig<R>> configuration() { | ||
return Optional.empty(); | ||
} | ||
} | ||
|
||
static class KubernetesDependentConfig<R extends HasMetadata> { | ||
|
||
} | ||
|
||
interface DependentResourceConfigurator<C> { | ||
void configureWith(C config); | ||
|
||
Optional<C> configuration(); | ||
} | ||
|
||
static final class ConfigMapDependentResource extends KubernetesDependentResource<ConfigMap, Service> { | ||
|
||
} | ||
|
||
static final class DeploymentDependentResource extends KubernetesDependentResource<Deployment, Service> { | ||
|
||
} | ||
|
||
} |