2 * Copyright (c) 2016 Red Hat, 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.yangtools.testutils.mockito.tests;
10 import static com.google.common.truth.Truth.assertThat;
11 import static org.junit.Assert.fail;
12 import static org.opendaylight.yangtools.testutils.mockito.MoreAnswers.exception;
14 import java.io.Closeable;
15 import java.io.IOException;
16 import org.junit.Test;
17 import org.mockito.Mockito;
18 import org.opendaylight.yangtools.testutils.mockito.UnstubbedMethodException;
20 public class MockitoUnstubbedMethodExceptionAnswerTest {
23 public void testAnswering() throws IOException {
24 Closeable mock = Mockito.mock(Closeable.class, exception());
28 } catch (UnstubbedMethodException e) {
29 assertThat(e.getMessage()).isEqualTo("close() is not stubbed in mock of java.io.Closeable");