@Override
  public List<ApolloAuditLogDTO> queryLogsByOpName(String opName, Date startDate, Date endDate,
      int page, int size) {
    if (startDate == null && endDate == null) {
      return ApolloAuditUtil.logListToDTOList(logService.findByOpName(opName, page, size));
    }
    return ApolloAuditUtil.logListToDTOList(
        logService.findByOpNameAndTime(opName, startDate, endDate, page, size));
  }
@Test
  public void testQueryLogsByOpName() {
    final String opName = "query-op-name";
    final Date startDate = new Date();
    final Date endDate = new Date();
    {
      List<ApolloAuditLog> logList = MockBeanFactory.mockAuditLogListByLength(size);
      Mockito.when(logService.findByOpNameAndTime(Mockito.eq(opName),
              Mockito.eq(startDate), Mockito.eq(endDate), Mockito.eq(page), Mockito.eq(size)))
          .thenReturn(logList);
    }

    List<ApolloAuditLogDTO> dtoList = api.queryLogsByOpName(opName, startDate, endDate, page, size);
    Mockito.verify(logService, Mockito.times(1))
        .findByOpNameAndTime(Mockito.eq(opName),
            Mockito.eq(startDate), Mockito.eq(endDate), Mockito.eq(page), Mockito.eq(size));
    assertEquals(size, dtoList.size());
  }