// Path: src/main/java/com/github/liblevenshtein/distance/IDistance.java
// public interface IDistance<Term> extends Serializable {
// 
//   /**
//    * Finds the distance between two terms, {@code v} and {@code w}. The distance
//    * between two terms is complemented by their similarity, which is determined
//    * by subtracting their distance from the maximum distance they may be apart.
//    * @param v Term to compare with {@code w}
//    * @param w Term to compare with {@code v}
//    * @return Distance between {@code v} and {@code w}
//    */
//   int between(Term v, Term w);
// }
// 
// Path: src/main/java/com/github/liblevenshtein/transducer/Candidate.java
// @Value
// public class Candidate implements Serializable {
// 
//   private static final long serialVersionUID = 1L;
// 
//   /**
//    * Candidate term from the dictionary automaton.
//    * @return Candidate term from the dictionary automaton.
//    */
//   private final String term;
// 
//   /**
//    * Distance between the candidate term and the query term.
//    * @return Distance between the candidate term and the query term.
//    */
//   private final int distance;
// }
// 
// Path: src/test/java/com/github/liblevenshtein/assertion/CandidateAssertions.java
// public static CandidateAssertions assertThat(final Candidate actual) {
//   return new CandidateAssertions(actual);
// }


import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.github.liblevenshtein.distance.IDistance;
import com.github.liblevenshtein.transducer.Candidate;
import static com.github.liblevenshtein.assertion.CandidateAssertions.assertThat;
package com.github.liblevenshtein.assertion;





public class CandidateAssertionsTest {

  private static final String FOO = "foo";

  private static final String BAR = "bar";

  private final ThreadLocal<IDistance<String>> distance = new ThreadLocal<>();

  @BeforeMethod
  @SuppressWarnings("unchecked")
  public void setUp() {
    distance.set(mock(IDistance.class));
  }

  @Test
  public void testHasDistance() {
    final Candidate candidate = new Candidate(BAR, 3);
    when(distance.get().between(FOO, BAR)).thenReturn(3);
// Path: src/main/java/com/github/liblevenshtein/distance/IDistance.java
// public interface IDistance<Term> extends Serializable {
// 
//   /**
//    * Finds the distance between two terms, {@code v} and {@code w}. The distance
//    * between two terms is complemented by their similarity, which is determined
//    * by subtracting their distance from the maximum distance they may be apart.
//    * @param v Term to compare with {@code w}
//    * @param w Term to compare with {@code v}
//    * @return Distance between {@code v} and {@code w}
//    */
//   int between(Term v, Term w);
// }
// 
// Path: src/main/java/com/github/liblevenshtein/transducer/Candidate.java
// @Value
// public class Candidate implements Serializable {
// 
//   private static final long serialVersionUID = 1L;
// 
//   /**
//    * Candidate term from the dictionary automaton.
//    * @return Candidate term from the dictionary automaton.
//    */
//   private final String term;
// 
//   /**
//    * Distance between the candidate term and the query term.
//    * @return Distance between the candidate term and the query term.
//    */
//   private final int distance;
// }
// 
// Path: src/test/java/com/github/liblevenshtein/assertion/CandidateAssertions.java
// public static CandidateAssertions assertThat(final Candidate actual) {
//   return new CandidateAssertions(actual);
// }


// Path: src/test/java/com/github/liblevenshtein/assertion/CandidateAssertionsTest.java
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.github.liblevenshtein.distance.IDistance;
import com.github.liblevenshtein.transducer.Candidate;
import static com.github.liblevenshtein.assertion.CandidateAssertions.assertThat;

package com.github.liblevenshtein.assertion;





public class CandidateAssertionsTest {

  private static final String FOO = "foo";

  private static final String BAR = "bar";

  private final ThreadLocal<IDistance<String>> distance = new ThreadLocal<>();

  @BeforeMethod
  @SuppressWarnings("unchecked")
  public void setUp() {
    distance.set(mock(IDistance.class));
  }

  @Test
  public void testHasDistance() {
    final Candidate candidate = new Candidate(BAR, 3);
    when(distance.get().between(FOO, BAR)).thenReturn(3);
    assertThat(candidate).hasDistance(distance.get(), FOO);