|
| 1 | +/* |
| 2 | + * Copyright (C) 2023 The Guava Authors |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package com.google.common.util.concurrent; |
| 18 | + |
| 19 | +import static com.google.common.truth.Truth.assertWithMessage; |
| 20 | + |
| 21 | +import java.util.concurrent.Executor; |
| 22 | +import java.util.concurrent.Future; |
| 23 | +import junit.framework.TestCase; |
| 24 | + |
| 25 | +/** Test for {@link ListenableFuture}. */ |
| 26 | +public class ListenableFutureTest extends TestCase { |
| 27 | + public void testNoNewApis() throws Exception { |
| 28 | + assertWithMessage( |
| 29 | + "Do not add new methods to ListenableFuture. Its API needs to continue to match the" |
| 30 | + + " version we released in a separate artifact com.google.guava:listenablefuture.") |
| 31 | + .that(ListenableFuture.class.getDeclaredMethods()) |
| 32 | + .asList() |
| 33 | + .containsExactly( |
| 34 | + ListenableFuture.class.getMethod("addListener", Runnable.class, Executor.class)); |
| 35 | + assertWithMessage( |
| 36 | + "Do not add new supertypes to ListenableFuture. Its API needs to continue to match the" |
| 37 | + + " version we released in a separate artifact com.google.guava:listenablefuture.") |
| 38 | + .that(ListenableFuture.class.getInterfaces()) |
| 39 | + .asList() |
| 40 | + .containsExactly(Future.class); |
| 41 | + } |
| 42 | +} |
0 commit comments