001/* 002 * Copyright 2023 the original author or authors. 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package de.cuioss.test.valueobjects.objects.impl; 017 018import java.util.Collections; 019import java.util.List; 020 021import de.cuioss.test.valueobjects.api.object.ObjectTestContract; 022import de.cuioss.test.valueobjects.objects.ParameterizedInstantiator; 023import de.cuioss.test.valueobjects.objects.RuntimeProperties; 024import de.cuioss.test.valueobjects.property.PropertyMetadata; 025import de.cuioss.test.valueobjects.property.PropertySupport; 026 027/** 028 * {@link ParameterizedInstantiator} for cases you actually are not able to use 029 * the testing Infrastructure but want to benefit of the testing of the 030 * {@link ObjectTestContract}s 031 * 032 * @author Oliver Wolff 033 * @param <T> identifying the type of object to be instantiated 034 */ 035public abstract class AbstractInlineInstantiator<T> implements ParameterizedInstantiator<T> { 036 037 /** "Properties must not be null, but may be empty". */ 038 public static final String PROPERTIES_MUST_NOT_BE_NULL = "Properties must not be null, but may be empty"; 039 040 @Override 041 public T newInstance(final List<PropertySupport> properties, final boolean generatePropertyValues) { 042 return any(); 043 } 044 045 @Override 046 public T newInstance(final List<PropertyMetadata> properties) { 047 return any(); 048 } 049 050 @Override 051 public RuntimeProperties getRuntimeProperties() { 052 return new RuntimeProperties(Collections.emptyList()); 053 } 054 055 @Override 056 public T newInstanceMinimal() { 057 return any(); 058 } 059 060 @Override 061 public T newInstanceFull() { 062 return any(); 063 } 064 065 protected abstract T any(); 066}