JAL-3210 Barebones gradle/buildship/eclipse. See README
[jalview.git] / src / jalview / ws / SequenceFetcherFactory.java
index 7aad74a..9cc4960 100644 (file)
  */
 package jalview.ws;
 
+import jalview.ws.seqfetcher.ASequenceFetcher;
+
 public class SequenceFetcherFactory
 {
-  // BH the two methods in this class merged into SequenceFetcher
+
+  private static SequenceFetcher instance;
+
+  /**
+   * Returns a new SequenceFetcher object, or a mock object if one has been set
+   * 
+   * @return
+   */
+  public static ASequenceFetcher getSequenceFetcher()
+  {
+    return instance == null ? new SequenceFetcher() : instance;
+  }
+
+  /**
+   * Set the instance object to use (intended for unit testing with mock
+   * objects).
+   * 
+   * Be sure to reset to null in the tearDown method of any tests!
+   * 
+   * @param sf
+   */
+  public static void setSequenceFetcher(SequenceFetcher sf)
+  {
+    instance = sf;
+  }
 }