All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.instancio.LenientModeApi Maven / Gradle / Ivy

There is a newer version: 5.2.1
Show newest version
/*
 * Copyright 2022-2024 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
 *
 *      https://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.instancio;

import org.instancio.settings.Keys;

/**
 * Provides support for lenient mode.
 *
 * 

Instancio supports two modes: strict and lenient, an idea inspired by * Mockito's highly useful strict stubbing feature. * *

In strict mode, unused selectors will trigger an error. In lenient mode, * unused selectors are ignored. By default, Instancio runs in strict mode. * Strict mode can be disabled by invoking the {@link #lenient()} method * or using the {@link Keys#MODE} setting. * *

Strict mode can catch potential data setup problems, therefore disabling * it is not recommended. A better alternative is to mark an individual * selector as lenient using the {@link LenientSelector#lenient()} method. * * @see Keys#MODE * @see LenientSelector * @since 4.0.0 */ interface LenientModeApi { /** * Disables strict mode in which unused selectors trigger an error. * In lenient mode unused selectors are simply ignored. * *

This method is a shorthand for: * *

{@code
     * Example example = Instancio.of(Example.class)
     *     .withSetting(Keys.MODE, Mode.LENIENT)
     *     .create();
     * }
* * @return API builder reference * @since 4.0.0 */ LenientModeApi lenient(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy