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

org.mockito.internal.util.Checks Maven / Gradle / Ivy

/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */

package org.mockito.internal.util;

/**
 * Pre-made preconditions
 */
public class Checks {

    public static  T checkNotNull(T value, String checkedValue) {
        if(value == null) {
            throw new IllegalArgumentException(checkedValue + " should not be null");
        }
        return value;
    }

    public static > T checkItemsNotNull(T iterable, String checkedIterable) {
        checkNotNull(iterable, checkedIterable);
        for (Object item : iterable) {
            checkNotNull(item, "item in " + checkedIterable);
        }
        return iterable;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy