// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static <T> Matcher<Future<T>> futureCompletedWithException() {
//   return futureCompletedWithExceptionThat(any(Throwable.class));
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static <T> Matcher<Future<T>> futureCompletedWithExceptionThat(
//     final Matcher<? extends Throwable> matcher) {
//   return new ExceptionallyCompletedFuture<>(matcher);
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static Matcher<Future<?>> futureCompletedWithValue() {
//   return futureCompletedWithValueThat(CoreMatchers.anything());
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static <T> Matcher<Future<? extends T>> futureCompletedWithValueThat(
//     final Matcher<T> matcher) {
//   return new SuccessfullyCompletedFuture<>(matcher);
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static <T> Matcher<Future<T>> futureWillCompleteWithException() {
//   return futureWillCompleteWithExceptionThat(any(Throwable.class));
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static <T> Matcher<Future<T>> futureWillCompleteWithExceptionThat(
//     final Matcher<? extends Throwable> matcher) {
//   return new ExceptionallyCompletedBlockingFuture<>(matcher);
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static Matcher<Future<?>> futureWillCompleteWithValue() {
//   return futureWillCompleteWithValueThat(CoreMatchers.anything());
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static <T> Matcher<Future<? extends T>> futureWillCompleteWithValueThat(
//     final Matcher<T> matcher) {
//   return new SuccessfullyCompletedBlockingFuture<>(matcher);
// }


import static com.spotify.hamcrest.future.FutureMatchers.futureCompletedWithException;
import static com.spotify.hamcrest.future.FutureMatchers.futureCompletedWithExceptionThat;
import static com.spotify.hamcrest.future.FutureMatchers.futureCompletedWithValue;
import static com.spotify.hamcrest.future.FutureMatchers.futureCompletedWithValueThat;
import static com.spotify.hamcrest.future.FutureMatchers.futureWillCompleteWithException;
import static com.spotify.hamcrest.future.FutureMatchers.futureWillCompleteWithExceptionThat;
import static com.spotify.hamcrest.future.FutureMatchers.futureWillCompleteWithValue;
import static com.spotify.hamcrest.future.FutureMatchers.futureWillCompleteWithValueThat;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.isA;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.CoreMatchers.sameInstance;
import static org.junit.Assert.assertThat;
import com.google.common.util.concurrent.Futures;
import java.util.concurrent.Future;
import org.junit.Test;
/*-
 * -\-\-
 * hamcrest-future
 * --
 * Copyright (C) 2016 Spotify AB
 * --
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * -/-/-
 */

package com.spotify.hamcrest.future;



public class FutureMatchersTest {

  @Test
  public void exceptional() {
    final RuntimeException ex = new RuntimeException("oops");

    final Future<String> cf = Futures.immediateFailedFuture(ex);

    assertThat(cf, futureCompletedWithException());
    assertThat(cf, futureCompletedWithExceptionThat(is(sameInstance(ex))));
    assertThat(cf, futureCompletedWithExceptionThat(isA(RuntimeException.class)));
    assertThat(cf, futureWillCompleteWithException());
    assertThat(cf, futureWillCompleteWithExceptionThat(is(sameInstance(ex))));
    assertThat(cf, futureWillCompleteWithExceptionThat(isA(RuntimeException.class)));
  }

  @Test
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static <T> Matcher<Future<T>> futureCompletedWithException() {
//   return futureCompletedWithExceptionThat(any(Throwable.class));
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static <T> Matcher<Future<T>> futureCompletedWithExceptionThat(
//     final Matcher<? extends Throwable> matcher) {
//   return new ExceptionallyCompletedFuture<>(matcher);
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static Matcher<Future<?>> futureCompletedWithValue() {
//   return futureCompletedWithValueThat(CoreMatchers.anything());
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static <T> Matcher<Future<? extends T>> futureCompletedWithValueThat(
//     final Matcher<T> matcher) {
//   return new SuccessfullyCompletedFuture<>(matcher);
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static <T> Matcher<Future<T>> futureWillCompleteWithException() {
//   return futureWillCompleteWithExceptionThat(any(Throwable.class));
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static <T> Matcher<Future<T>> futureWillCompleteWithExceptionThat(
//     final Matcher<? extends Throwable> matcher) {
//   return new ExceptionallyCompletedBlockingFuture<>(matcher);
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static Matcher<Future<?>> futureWillCompleteWithValue() {
//   return futureWillCompleteWithValueThat(CoreMatchers.anything());
// }
// 
// Path: future/src/main/java/com/spotify/hamcrest/future/FutureMatchers.java
// public static <T> Matcher<Future<? extends T>> futureWillCompleteWithValueThat(
//     final Matcher<T> matcher) {
//   return new SuccessfullyCompletedBlockingFuture<>(matcher);
// }


// Path: future/src/test/java/com/spotify/hamcrest/future/FutureMatchersTest.java
import static com.spotify.hamcrest.future.FutureMatchers.futureCompletedWithException;
import static com.spotify.hamcrest.future.FutureMatchers.futureCompletedWithExceptionThat;
import static com.spotify.hamcrest.future.FutureMatchers.futureCompletedWithValue;
import static com.spotify.hamcrest.future.FutureMatchers.futureCompletedWithValueThat;
import static com.spotify.hamcrest.future.FutureMatchers.futureWillCompleteWithException;
import static com.spotify.hamcrest.future.FutureMatchers.futureWillCompleteWithExceptionThat;
import static com.spotify.hamcrest.future.FutureMatchers.futureWillCompleteWithValue;
import static com.spotify.hamcrest.future.FutureMatchers.futureWillCompleteWithValueThat;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.isA;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.CoreMatchers.sameInstance;
import static org.junit.Assert.assertThat;
import com.google.common.util.concurrent.Futures;
import java.util.concurrent.Future;
import org.junit.Test;

/*-
 * -\-\-
 * hamcrest-future
 * --
 * Copyright (C) 2016 Spotify AB
 * --
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * -/-/-
 */

package com.spotify.hamcrest.future;



public class FutureMatchersTest {

  @Test
  public void exceptional() {
    final RuntimeException ex = new RuntimeException("oops");

    final Future<String> cf = Futures.immediateFailedFuture(ex);

    assertThat(cf, futureCompletedWithException());
    assertThat(cf, futureCompletedWithExceptionThat(is(sameInstance(ex))));
    assertThat(cf, futureCompletedWithExceptionThat(isA(RuntimeException.class)));
    assertThat(cf, futureWillCompleteWithException());
    assertThat(cf, futureWillCompleteWithExceptionThat(is(sameInstance(ex))));
    assertThat(cf, futureWillCompleteWithExceptionThat(isA(RuntimeException.class)));
  }

  @Test
  public void success() {