### Question:
RangerServiceService extends RangerServiceServiceBase<XXService, RangerService> { public List<XXTrxLog> getTransactionLog(RangerService vService, int action){ return getTransactionLog(vService, null, action); } RangerServiceService(); RangerService getPopulatedViewObject(XXService xService); List<RangerService> getAllServices(); List<XXTrxLog> getTransactionLog(RangerService vService, int action); List<XXTrxLog> getTransactionLog(RangerService vObj, XXService mObj, int action); Map<String, String> getConfigsWithDecryptedPassword(RangerService service);  }### Answer:
@Test public void test6GetTransactionLogCreate() { XXServiceDefDao xServiceDefDao = Mockito.mock(XXServiceDefDao.class); XXServiceDef xServiceDef = Mockito.mock(XXServiceDef.class); RangerService rangerService = rangerService(); Mockito.when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao); Mockito.when(xServiceDefDao.findByName(rangerService.getType())) .thenReturn(xServiceDef); String value = null; Map<String, String> configs = new HashMap<String, String>(); Mockito.when(jsonUtil.readMapToString(configs)).thenReturn(value); List<XXTrxLog> dbXXTrxLogList = serviceService.getTransactionLog( rangerService, 1); Assert.assertNotNull(dbXXTrxLogList); }
@Test public void test7GetTransactionLogUpdate() { XXServiceDefDao xServiceDefDao = Mockito.mock(XXServiceDefDao.class); XXServiceDef xServiceDef = Mockito.mock(XXServiceDef.class); RangerService rangerService = rangerService(); Mockito.when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao); Mockito.when(xServiceDefDao.findByName(rangerService.getType())) .thenReturn(xServiceDef); String value = null; Map<String, String> configs = new HashMap<String, String>(); Mockito.when(jsonUtil.readMapToString(configs)).thenReturn(value); List<XXTrxLog> dbXXTrxLogList = serviceService.getTransactionLog( rangerService, 2); Assert.assertNull(dbXXTrxLogList); }
@Test public void test8GetTransactionLogDelete() { XXServiceDefDao xServiceDefDao = Mockito.mock(XXServiceDefDao.class); XXServiceDef xServiceDef = Mockito.mock(XXServiceDef.class); RangerService rangerService = rangerService(); Mockito.when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao); Mockito.when(xServiceDefDao.findByName(rangerService.getType())) .thenReturn(xServiceDef); String value = null; Map<String, String> configs = new HashMap<String, String>(); Mockito.when(jsonUtil.readMapToString(configs)).thenReturn(value); List<XXTrxLog> dbXXTrxLogList = serviceService.getTransactionLog( rangerService, 3); Assert.assertNotNull(dbXXTrxLogList); }