/*
 * Copyright 2015-2018 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v2.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v20.html
 */

package org.junit.platform.commons.support;

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

import java.util.List;
import java.util.function.Function;

import org.junit.jupiter.api.Test;
import org.junit.platform.commons.util.ClassUtils;

/**
 * @since 1.1
 */
class ClassSupportTests {

	@Test
	void nullSafeToStringDelegates() {
		assertEquals(ClassUtils.nullSafeToString(String.class, List.class),
			ClassSupport.nullSafeToString(String.class, List.class));

		Function<Class<?>, String> classToStringMapper = aClass -> aClass.getSimpleName() + "-Test";
		assertEquals(ClassUtils.nullSafeToString(classToStringMapper, String.class, List.class),
			ClassSupport.nullSafeToString(classToStringMapper, String.class, List.class));
	}
}

@@ -412,16 +412,132 @@
 tEquals;
+%0Aimport static org.junit.platform.commons.support.PreconditionViolationChecker.assertPreconditionViolationException;
 %0A%0Aimport
@@ -726,16 +726,271 @@
 ests %7B%0A%0A
+%09@Test%0A%09void nullSafeToString_argument1IsValidated() %7B%0A%09%09Function%3C? super Class%3C?%3E, ? extends String%3E mapper = null;%0A%09%09assertPreconditionViolationException(%22Mapping function%22,%0A%09%09%09() -%3E ClassSupport.nullSafeToString(mapper, String.class, List.class));%0A%09%7D%0A%0A
 %09@Test%0A%09

Check arguments of methods for null safety for ClassSupport