83260b7a2e39a8a26a94dff9863dc0735481565a
[yangtools.git] / common / mockito-configuration / src / test / java / org / opendaylight / mockito / DefaultAnswerTest.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mockito;
9
10 import static org.junit.jupiter.api.Assertions.assertEquals;
11 import static org.junit.jupiter.api.Assertions.assertThrows;
12
13 import java.io.Closeable;
14 import org.junit.jupiter.api.Test;
15 import org.junit.jupiter.api.extension.ExtendWith;
16 import org.mockito.Mock;
17 import org.mockito.junit.jupiter.MockitoExtension;
18
19 @ExtendWith(MockitoExtension.class)
20 class DefaultAnswerTest {
21     @Mock
22     private Closeable mock;
23
24     @Test
25     void testAnswering() {
26         final var e = assertThrows(UnstubbedMethodException.class, mock::close);
27         assertEquals("mock.close(); was not stubbed", e.getMessage());
28     }
29 }