2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.dom.broker;
10 import org.mockito.ArgumentCaptor;
11 import org.mockito.Mockito;
13 final class MockingUtilities {
15 private MockingUtilities() {
16 throw new UnsupportedOperationException("Utility class");
19 public static <T> T mock(final Class<T> type, final String toString) {
20 final T mock = Mockito.mock(type);
21 Mockito.doReturn(toString).when(mock).toString();
25 @SuppressWarnings({"unchecked", "rawtypes"})
26 public static <T, F extends T> ArgumentCaptor<F> captorFor(final Class<T> rawClass) {
27 return (ArgumentCaptor) ArgumentCaptor.forClass(rawClass);