// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
//  HasResourcePath<T> {
// 
// }
// 
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
//   private final int id;
// 
//   public ResourceId(int id) {
//     this.id = id;
//   }
// 
//   public int getId() {
//     return id;
//   }
// 
//   @Override
//   public String toString() {
//     return Integer.toString(id);
//   }
// 
//   @Override
//   public int hashCode() {
//     final int prime = 31;
//     int result = 1;
//     result = prime * result + id;
//     return result;
//   }
// 
//   @SuppressWarnings("rawtypes")
//   @Override
//   public boolean equals(Object obj) {
//     if (this == obj)
//       return true;
//     if (obj == null)
//       return false;
//     if (getClass() != obj.getClass())
//       return false;
//     ResourceId other = (ResourceId) obj;
//     if (id != other.id)
//       return false;
//     return true;
//   }
// }
// 
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
//   private String title;
//   private String role;
//   @JsonProperty("id")
//   private ResourceId<App> resourceId;
//   @JsonProperty("link")
//   private ResourcePath<App> resourcePath;
// 
//   @Override
//   public ResourceId<App> getResourceId() {
//     return resourceId;
//   }
// 
//   public void setResourceId(ResourceId<App> resourceId) {
//     this.resourceId = resourceId;
//   }
// 
//   @Override
//   public ResourcePath<App> getResourcePath() {
//     return resourcePath;
//   }
// 
//   public void setResourcePath(ResourcePath<App> resourcePath) {
//     this.resourcePath = resourcePath;
//   }
//   public String getTitle() {
//     return title;
//   }
// 
//   public void setTitle(String title) {
//     this.title = title;
//   }
// 
//   public String getRole() {
//     return role;
//   }
// 
//   public void setRole(String role) {
//     this.role = role;
//   }
// 
// }
// 
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
// 
// }


import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.maven.plugin.MojoExecutionException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;
    fileResourceIdStore.setWorkingDirectory(workingDirectory);
    fileResourceIdStore.setAlias(ALIAS);
  }

  public void testAppAlreadyExistsNoFile() throws IOException, MojoExecutionException {
    assertNull(fileResourceIdStore.load(getEmptyAppList()));
  }

  private MeAppResponse[] getEmptyAppList() {
    return new MeAppResponse[0];
  }

  public void testAppAlreadyExistsNoAssociatedId() throws IOException, MojoExecutionException {
    createFileContainingId(10);
    assertNull(fileResourceIdStore.load(getEmptyAppList()));
  }

  public void testOverrideIdNoAssociatedId() throws IOException, MojoExecutionException {
    try {
      fileResourceIdStore.setIdOverride(10);
      assertNull(fileResourceIdStore.load(getEmptyAppList()));
      fail("Should have thrown");
    } catch (RuntimeException e) {
      assertTrue(e.getMessage().startsWith("Override id 10 specified but not found"));
    }
  }

  public void testOverrideIdPositive() throws IOException, MojoExecutionException {
    final int id = 10;
    fileResourceIdStore.setIdOverride(id);
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/HasResourceIdAndPath.java
// public interface HasResourceIdAndPath<T extends AbstractResource> extends HasResourceId<T>,
//  HasResourcePath<T> {
// 
// }
// 
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/ResourceId.java
// public class ResourceId<T extends AbstractResource> {
//   private final int id;
// 
//   public ResourceId(int id) {
//     this.id = id;
//   }
// 
//   public int getId() {
//     return id;
//   }
// 
//   @Override
//   public String toString() {
//     return Integer.toString(id);
//   }
// 
//   @Override
//   public int hashCode() {
//     final int prime = 31;
//     int result = 1;
//     result = prime * result + id;
//     return result;
//   }
// 
//   @SuppressWarnings("rawtypes")
//   @Override
//   public boolean equals(Object obj) {
//     if (this == obj)
//       return true;
//     if (obj == null)
//       return false;
//     if (getClass() != obj.getClass())
//       return false;
//     ResourceId other = (ResourceId) obj;
//     if (id != other.id)
//       return false;
//     return true;
//   }
// }
// 
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/me/MeAppResponse.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class MeAppResponse implements HasResourceIdAndPath<App> {
//   private String title;
//   private String role;
//   @JsonProperty("id")
//   private ResourceId<App> resourceId;
//   @JsonProperty("link")
//   private ResourcePath<App> resourcePath;
// 
//   @Override
//   public ResourceId<App> getResourceId() {
//     return resourceId;
//   }
// 
//   public void setResourceId(ResourceId<App> resourceId) {
//     this.resourceId = resourceId;
//   }
// 
//   @Override
//   public ResourcePath<App> getResourcePath() {
//     return resourcePath;
//   }
// 
//   public void setResourcePath(ResourcePath<App> resourcePath) {
//     this.resourcePath = resourcePath;
//   }
//   public String getTitle() {
//     return title;
//   }
// 
//   public void setTitle(String title) {
//     this.title = title;
//   }
// 
//   public String getRole() {
//     return role;
//   }
// 
//   public void setRole(String role) {
//     this.role = role;
//   }
// 
// }
// 
// Path: api/src/main/java/com/github/chrisprice/phonegapbuild/api/data/resources/App.java
// public class App extends AbstractResource {
// 
// }


// Path: plugin/src/test/java/com/github/chrisprice/phonegapbuild/plugin/utils/FileResourceIdStoreTest.java
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.maven.plugin.MojoExecutionException;
import com.github.chrisprice.phonegapbuild.api.data.HasResourceIdAndPath;
import com.github.chrisprice.phonegapbuild.api.data.ResourceId;
import com.github.chrisprice.phonegapbuild.api.data.me.MeAppResponse;
import com.github.chrisprice.phonegapbuild.api.data.resources.App;

    fileResourceIdStore.setWorkingDirectory(workingDirectory);
    fileResourceIdStore.setAlias(ALIAS);
  }

  public void testAppAlreadyExistsNoFile() throws IOException, MojoExecutionException {
    assertNull(fileResourceIdStore.load(getEmptyAppList()));
  }

  private MeAppResponse[] getEmptyAppList() {
    return new MeAppResponse[0];
  }

  public void testAppAlreadyExistsNoAssociatedId() throws IOException, MojoExecutionException {
    createFileContainingId(10);
    assertNull(fileResourceIdStore.load(getEmptyAppList()));
  }

  public void testOverrideIdNoAssociatedId() throws IOException, MojoExecutionException {
    try {
      fileResourceIdStore.setIdOverride(10);
      assertNull(fileResourceIdStore.load(getEmptyAppList()));
      fail("Should have thrown");
    } catch (RuntimeException e) {
      assertTrue(e.getMessage().startsWith("Override id 10 specified but not found"));
    }
  }

  public void testOverrideIdPositive() throws IOException, MojoExecutionException {
    final int id = 10;
    fileResourceIdStore.setIdOverride(id);
    HasResourceIdAndPath<App> resourceIdAndPath = fileResourceIdStore.load(getAppListContainingId(id));