org.gradle.model.internal.core.ModelTypeJavaTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-api Show documentation
Show all versions of gradle-api Show documentation
Gradle 6.5 API redistribution.
/*
* Copyright 2013 the original author or authors.
*
* 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 org.gradle.model.internal.core;
import org.gradle.model.internal.type.ModelType;
import org.junit.Test;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
/**
* Tests that need full static typing.
*/
public class ModelTypeJavaTest {
static class Nested {
class Child { }
}
void m1(T t, S s, R r) { }
void m1(S s) { }
void m2(List... lists) { }
void m4(List... lists) { }
void m5(Collection... collections) { }
@Test
public void testNestedParameterizedType() {
// Suppress - checkstyle gets confused with type params on the outer type
//CHECKSTYLE:OFF
ModelType type = new ModelType.Child>() {};
assertEquals(type.getDisplayName(), "ModelTypeJavaTest.Nested.Child");
assertEquals(type.toString(), "org.gradle.model.internal.core.ModelTypeJavaTest.Nested.Child");
ModelType listType = new ModelType.Child>>() {};
assertEquals(listType.getDisplayName(), "List.Child>");
assertEquals(listType.toString(), "java.util.List.Child>");
//CHECKSTYLE:ON
}
@Test
public void testBuildType() throws Exception {
assertEquals(new ModelType