TraceService { @Transactional(readOnly = true) public LogTraceDTO findById(String id) { ObjectId oid = new ObjectId(id); LogTrace object = new LogTrace(); object.setId(oid); LogTrace logTrace = mongoConnection.findOne(object); return new LogTraceDTO(logTrace); }  @Transactional(readOnly = true) LogTraceDTO findById(String id); LogTraceDTOPage find(List<FiltersDTO> filtersDTOS, PageableDTO pageableDTO);  }
@Test public void findById() { Mockito.when(mongoLogConnector.findOne(Mockito.anyObject())).thenReturn(logTrace); LogTraceDTO actual = traceService.findById(logTrace.getId().toString()); assertEquals(logTrace.getTrace(), actual.getTrace()); }