test_class.declarator: operationService
test_class.modifier: @Inject
test_class.original_string: @Inject
      OperationServiceImpl operationService;
test_class.type: OperationServiceImpl
test_class.var_name: operationService
test_class.declarator: memcacheService
test_class.modifier: @Inject
test_class.original_string: @Inject
      MemcacheService memcacheService;
test_class.type: MemcacheService
test_class.var_name: memcacheService
test_class.file: gae-studio/gae-studio-server/src/test/java/com/arcbees/gaestudio/server/service/profiler/OperationServiceImplTest.java
test_class.identifier: OperationServiceImplTest
test_case.body: @Test
      public void testGetOperationLimitNotNullAndMostRecentIdEqualsLastId() {
          // Given
          Long lastId = 1L;
          when(memcacheService.get(MemcacheKey.DB_OPERATION_COUNTER.getName())).thenReturn(lastId);
  
          // when
          List<DbOperationRecordDto> results = operationService.getOperations(lastId, 2);
  
          // then
          verify(memcacheService).get(MemcacheKey.DB_OPERATION_COUNTER.getName());
          assertNull(results);
      }
test_case.class_method_signature: OperationServiceImplTest.testGetOperationLimitNotNullAndMostRecentIdEqualsLastId()
test_case.full_signature: @Test public void testGetOperationLimitNotNullAndMostRecentIdEqualsLastId()
test_case.identifier: testGetOperationLimitNotNullAndMostRecentIdEqualsLastId
test_case.invocations: thenReturn when get getName getOperations get verify getName assertNull
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetOperationLimitNotNullAndMostRecentIdEqualsLastId()
focal_class.declarator: memcacheService
focal_class.modifier: private final
focal_class.original_string: private final MemcacheService memcacheService;
focal_class.type: MemcacheService
focal_class.var_name: memcacheService
focal_class.file: gae-studio/gae-studio-server/src/main/java/com/arcbees/gaestudio/server/service/profiler/OperationServiceImpl.java
focal_class.identifier: OperationServiceImpl
focal_class.interfaces: implements OperationService
focal_class.class_method_signature: OperationServiceImpl.OperationServiceImpl(
              MemcacheService memcacheService)
focal_class.full_signature: @Inject  OperationServiceImpl(
              MemcacheService memcacheService)
focal_class.identifier: OperationServiceImpl
focal_class.modifiers: @Inject
focal_class.parameters: (
              MemcacheService memcacheService)
focal_class.signature:  OperationServiceImpl(
              MemcacheService memcacheService)
focal_class.class_method_signature: OperationServiceImpl.getMostRecentId()
focal_class.full_signature: @Override public Long getMostRecentId()
focal_class.identifier: getMostRecentId
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Long
focal_class.signature: Long getMostRecentId()
focal_class.class_method_signature: OperationServiceImpl.getOperations(Long lastId, Integer limit)
focal_class.full_signature: public List<DbOperationRecordDto> getOperations(Long lastId, Integer limit)
focal_class.identifier: getOperations
focal_class.modifiers: public
focal_class.parameters: (Long lastId, Integer limit)
focal_class.return: List<DbOperationRecordDto>
focal_class.signature: List<DbOperationRecordDto> getOperations(Long lastId, Integer limit)
focal_class.class_method_signature: OperationServiceImpl.getNewOperationRecordKeys(long beginId, long endId)
focal_class.full_signature: private List<String> getNewOperationRecordKeys(long beginId, long endId)
focal_class.identifier: getNewOperationRecordKeys
focal_class.modifiers: private
focal_class.parameters: (long beginId, long endId)
focal_class.return: List<String>
focal_class.signature: List<String> getNewOperationRecordKeys(long beginId, long endId)
focal_method.body: public List<DbOperationRecordDto> getOperations(Long lastId, Integer limit) {
          Long mostRecentId = getMostRecentId();
  
          if (mostRecentId == null) {
              return null;
          }
  
          long beginId = lastId + 1;
          // TODO if there is a big difference between beginId and the most recent id, binary search for the true start
          long endId = limit != null ? Math.min(lastId + limit, mostRecentId) : mostRecentId;
  
          if (beginId > endId) {
              return null;
          }
  
          Map<String, Object> recordsByKey = memcacheService.getAll(getNewOperationRecordKeys(beginId, endId));
          // TODO trimming missing results only from the end of the range is incorrect, as there are scenarios
          // in which there could be missing records in the middle. We need a better approach to this that
          // always retrieves all missing records.
  
          List<DbOperationRecordDto> records = new ArrayList<DbOperationRecordDto>(recordsByKey.size());
          for (Object recordObject : recordsByKey.values()) {
              records.add((DbOperationRecordDto) recordObject);
          }
  
          return records;
      }
focal_method.class_method_signature: OperationServiceImpl.getOperations(Long lastId, Integer limit)
focal_method.full_signature: public List<DbOperationRecordDto> getOperations(Long lastId, Integer limit)
focal_method.identifier: getOperations
focal_method.invocations: getMostRecentId min getAll getNewOperationRecordKeys size values add
focal_method.modifiers: public
focal_method.parameters: (Long lastId, Integer limit)
focal_method.return: List<DbOperationRecordDto>
focal_method.signature: List<DbOperationRecordDto> getOperations(Long lastId, Integer limit)