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

poussecafe.test.MockAttribute Maven / Gradle / Ivy

There is a newer version: 0.29.0
Show newest version
package poussecafe.test;

import java.util.Optional;
import poussecafe.attribute.Attribute;
import poussecafe.attribute.OptionalAttribute;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class MockAttribute {

    private MockAttribute() {

    }

    public static  Attribute mockAttribute(T value) {
        @SuppressWarnings("unchecked")
        Attribute property = mock(Attribute.class);
        when(property.value()).thenReturn(value);
        return property;
    }

    public static  OptionalAttribute mockOptionalAttribute(Optional value) {
        @SuppressWarnings("unchecked")
        OptionalAttribute property = mock(OptionalAttribute.class);
        when(property.value()).thenReturn(value);
        return property;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy