@Test
  public void testCountByG_U_F_M_StatusInTrashByMimeType() throws Exception {
    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    Assert.assertEquals(1, doCountBy_G_U_F_M(0, ContentTypes.TEXT_PLAIN, queryDefinition));
  }
  @Test
  public void testCountByG_U_F_M_StatusApproved() throws Exception {
    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_APPROVED);

    Assert.assertEquals(2, doCountBy_G_U_F_M(0, null, queryDefinition));
  }
  @Test
  public void testCountByG_U_F_M_StatusInTrash() throws Exception {
    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    Assert.assertEquals(2, doCountBy_G_U_F_M(0, null, queryDefinition));
  }
  @Test
  public void testCountByG_U_R_F_M_StatusAny_NewRepository() throws Exception {

    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_ANY);

    Assert.assertEquals(3, doCountBy_G_U_R_F_M_NewRepository(0, null, queryDefinition));
  }
  @Test
  public void testCountByG_U_F_M_StatusInTrashByUserId() throws Exception {
    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    Assert.assertEquals(
        1, doCountBy_G_U_F_M(_defaultRepositoryFolder.getUserId(), null, queryDefinition));
  }
  @Test
  public void testCountByG_U_F_M_StatusApprovedByMimeType_EmptyRepositories() throws Exception {

    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_APPROVED);

    Assert.assertEquals(
        2, doCountBy_G_U_R_F_M_EmptyRepositories(0, ContentTypes.TEXT_PLAIN, queryDefinition));
  }
  @Test
  public void testCountByG_U_R_F_M_StatusAnyByMimeType_NewRepository() throws Exception {

    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_ANY);

    Assert.assertEquals(
        2, doCountBy_G_U_R_F_M_NewRepository(0, ContentTypes.TEXT_PLAIN, queryDefinition));
  }
  @Test
  public void testCountByG_U_R_F_M_StatusAnyByUserId_EmptyRepositories() throws Exception {

    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_ANY);

    Assert.assertEquals(
        4,
        doCountBy_G_U_R_F_M_EmptyRepositories(
            _defaultRepositoryFolder.getUserId(), null, queryDefinition));
  }
  @Test
  public void testCountByG_U_F_M_StatusApprovedByUserIdAndMimeType() throws Exception {

    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_APPROVED);

    Assert.assertEquals(
        0,
        doCountBy_G_U_F_M(
            _defaultRepositoryFolder.getUserId(), ContentTypes.TEXT_PLAIN, queryDefinition));
  }
  @Test
  public void testCountByG_U_R_F_M_StatusApprovedByUserId_NewRepository() throws Exception {

    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_APPROVED);

    Assert.assertEquals(
        1,
        doCountBy_G_U_R_F_M_NewRepository(
            _defaultRepositoryFolder.getUserId(), null, queryDefinition));
  }
  @Test
  public void testFindByG_U_F_M_StatusInTrash_EmptyRepositories() throws Exception {

    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    List<DLFileEntry> dlFileEntries =
        doFindBy_G_U_R_F_M_EmptyRepositories(0, ContentTypes.TEXT_PLAIN, queryDefinition);

    Assert.assertEquals(2, dlFileEntries.size());
  }
  @Test
  public void testFindByG_U_F_M_StatusApproved_EmptyRepositories() throws Exception {

    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_APPROVED);

    List<DLFileEntry> dlFileEntries =
        doFindBy_G_U_R_F_M_EmptyRepositories(
            _defaultRepositoryFolder.getUserId(), null, queryDefinition);

    Assert.assertEquals(2, dlFileEntries.size());
  }
  @Test
  public void testFindByG_U_F_M_StatusAny_BothRepositories() throws Exception {

    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_ANY);

    List<DLFileEntry> dlFileEntries =
        doFindBy_G_U_R_F_M_BothRepositories(
            _defaultRepositoryFolder.getUserId(), ContentTypes.TEXT_PLAIN, queryDefinition);

    Assert.assertEquals(2, dlFileEntries.size());
  }
  @Test
  public void testCountByG_U_R_F_M_StatusInTrashByUserIdAndMimeType_NewRepository()
      throws Exception {

    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    Assert.assertEquals(
        0,
        doCountBy_G_U_R_F_M_NewRepository(
            _defaultRepositoryFolder.getUserId(), ContentTypes.TEXT_PLAIN, queryDefinition));
  }
  @Test
  public void testFindByG_U_F_M_StatusInTrash() throws Exception {
    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    List<DLFileEntry> dlFileEntries = doFindBy_G_U_F_M(0, ContentTypes.TEXT_PLAIN, queryDefinition);

    Assert.assertEquals(1, dlFileEntries.size());

    DLFileEntry dlFileEntry = dlFileEntries.get(0);

    Assert.assertEquals("FE1.txt", dlFileEntry.getTitle());
  }
  @Test
  public void testFindByG_U_F_M_StatusApproved_NewRepository() throws Exception {

    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_APPROVED);

    List<DLFileEntry> dlFileEntries =
        doFindBy_G_U_R_F_M_NewRepository(_newRepositoryFolder.getUserId(), null, queryDefinition);

    Assert.assertEquals(1, dlFileEntries.size());

    DLFileEntry dlFileEntry = dlFileEntries.get(0);

    Assert.assertEquals("FE2.pdf-NewRepository", dlFileEntry.getTitle());
  }
  @Test
  public void testFindByG_U_F_M_StatusAny_NewRepository() throws Exception {
    QueryDefinition<DLFileEntry> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_ANY);

    List<DLFileEntry> dlFileEntries =
        doFindBy_G_U_R_F_M_NewRepository(
            _newRepositoryFolder.getUserId(), ContentTypes.TEXT_PLAIN, queryDefinition);

    Assert.assertEquals(1, dlFileEntries.size());

    DLFileEntry dlFileEntry = dlFileEntries.get(0);

    Assert.assertEquals("FE3.txt", dlFileEntry.getDescription());
  }