@Test
  public void testExportReadsets_badIds() throws Exception {
    ExportReadsCommand command = new ExportReadsCommand();
    command.readGroupSetIds = Lists.newArrayList("bad");

    // Get the readsets
    Mockito.when(readsets.get(Mockito.anyString())).thenThrow(GoogleJsonResponseException.class);
    command.handleRequest(genomics);

    String output = outContent.toString();
    assertTrue(output, output.contains("The read group set ID bad won't work"));
  }
  @Test
  public void testExportReadsets() throws Exception {
    ExportReadsCommand command = new ExportReadsCommand();
    command.setDataStoreFactory(new MemoryDataStoreFactory());

    command.readGroupSetIds = Lists.newArrayList("r1", "r2");
    command.projectNumber = 3L;
    command.exportUri = "exportme";

    // Get the readsets
    Mockito.when(readsets.get("r1")).thenReturn(readsetGet);
    Mockito.when(readsets.get("r2")).thenReturn(readsetGet);
    Mockito.when(readsetGet.execute())
        .thenReturn(new ReadGroupSet().setName("name1"), new ReadGroupSet().setName("name2"));

    // Export them
    Mockito.when(readsets.export(Mockito.any(ExportReadGroupSetsRequest.class)))
        .thenReturn(readsetExport);
    Mockito.when(readsetExport.execute())
        .thenReturn(new ExportReadGroupSetsResponse().setJobId("8675309"));

    // Get the job
    Mockito.when(jobs.get("8675309")).thenReturn(jobGet);
    Mockito.when(jobGet.execute()).thenReturn(new Job().setDetailedStatus("description1"));

    command.handleRequest(genomics);

    String output = outContent.toString();
    assertTrue(output, output.contains("Exporting read group sets name1,name2"));
    assertTrue(output, output.contains("Export job:"));
    assertTrue(output, output.contains("description1"));
  }