poussecafe.test.MockAttribute Maven / Gradle / Ivy
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;
}
}