@Test
public void testFastaLoad() throws Exception {

    UniProtFastaLoaderTask flt = new UniProtFastaLoaderTask();
    flt.setTaxonId("7227");
    flt.setIgnoreDuplicates(true);
    flt.setSequenceType("protein");
    flt.setClassName("org.intermine.model.bio.Protein");
    flt.setIntegrationWriterAlias("integration.bio-test");
    flt.setSourceName("fasta-test");
    flt.setDataSetTitle(dataSetTitle);
    flt.setDataSourceName(dataSourceName);
    flt.setClassAttribute("primaryAccession");
    flt.setLicence(LICENCE);
    File[] files = new File[1];
    files[0] = File.createTempFile("UniProtFastaLoaderTaskTest", "tmp");
    FileWriter fw = new FileWriter(files[0]);
    InputStream is =
        getClass().getClassLoader().getResourceAsStream("uniprot.fasta");
    BufferedReader br = new BufferedReader(new InputStreamReader(is));
    String line = null;
    while ((line = br.readLine()) != null) {
        fw.write(line + "\n");
    }
    fw.close();
    files[0].deleteOnExit();
    flt.setFileArray(files);
    flt.execute();
    flt.close();
    //Check the results to see if we have some data...
    ObjectStore os = osw.getObjectStore();
    Query q = new Query();
    QueryClass queryClass = new QueryClass(Protein.class);
    QueryClass seqQueryClass = new QueryClass(Sequence.class);
    q.addToSelect(queryClass);
    q.addToSelect(seqQueryClass);
    q.addFrom(queryClass);
    q.addFrom(seqQueryClass);
    QueryObjectReference qor = new QueryObjectReference(queryClass, "sequence");
    ContainsConstraint cc = new ContainsConstraint(qor, ConstraintOp.CONTAINS, seqQueryClass);
    q.setConstraint(cc);
    Results r = os.execute(q);
    assertEquals(1, r.size());
    Protein protein = (Protein) ((List) r.get(0)).get(0);
    assertEquals("Q9V8R9-2", protein.getPrimaryAccession());
    "7227".equals(protein.getOrganism().getTaxonId());
    DataSet dataSet = protein.getDataSets().iterator().next();
    assertEquals(dataSetTitle, dataSet.getName());
    assertEquals(dataSourceName, dataSet.getDataSource().getName());
    assertEquals(LICENCE, dataSet.getLicence());
    /*
    >sp|Q9V8R9-2|41_DROME Isoform 2 of Protein 4.1 homolog OS=Drosophila melanogaster GN=cora
    */
    assertEquals("MPAEIKPSAPAEPETPTKSKPKSSSSSHGKPALARVTLLDGSLLDVSIDRKAIGRDVINS"
                 + "ICAGLNLIEKDYFGLTYETPTDPRTWLDLEKPVSKFFRTDTWPLTFAVKFYPPEPSQLKE"
                 + "DITRYHLCLQVRNDILEGRLPCTFVTHALLGSYLVQSEMGDYDAEEMPTRAYLKDFKIAP"
                 + "NQTAELEDKVMDLHKTHKGQSPAEAELHYLENAKKLAMYGVDLHPAKDSEGVDIMLGVCA"
                 + "SGLLVYRDKLRINRFAWPKILKISYKRHHFYIKIRPGEFEQYESTIGFKLANHRAAKKLW"
                 + "KSCVEHHTFFRLMTPEPVSKSKMFPVFGSTYRYKGRTQAESTNTPVDRTPPKFNRTLSGA"
                 + "RLTSRSMDALALAEKEKVARKSSTLDHRGDRNADGDAHSRSPIKNKKEKSSTGTASASSQ"
                 + "SSLEGDYETNLEIEAIEAEPPVQDADKEAKLREKKQKEKEEKERKEREKRELEEKKKAEK"
                 + "AAKAALAAGAAAGAAVNGNDELNDSNKSDKSSGRRVDPNDPRFAGARTTVTHTMTLTGEI"
                 + "DPVTGRIKSEYGDIDPNTGDIDPATAVTDPVTGKLILNYAQIDPSHFGKQAQVQTTTETV"
                 + "PITRQQFFDGVKHISKGALRRDSEGSSDDDMTAQYGADQVNEILIGSPAGQAGGKLGKPV"
                 + "STPTVVKTTTKQVLTKNIDGVTHNVEEEVRNLGTGEVTYSTQEHKADATPTDLSGAYVTA"
                 + "TAVTTRTATTHEDLGKNAKTEQLEEKTVATTRTHDPNKQQQRVVTQEVKTTATVTSGDQK"
                 + "SPLFTTSATTGPHVESTRVVLGEDTPGFSGHGEIISTQTGGGGGGI", protein.getSequence().getResidues().toString());
}