コード例 #1
0
  @Test
  public void testGetConnectionManager_Standalone() {

    ConnectionManager connectionManager = mock(ConnectionManager.class);

    SQLiteIndex<String, Car, Integer> carFeaturesOffHeapIndex =
        new SQLiteIndex<String, Car, Integer>(
            Car.FEATURES, OBJECT_TO_ID, ID_TO_OBJECT, connectionManager);

    assertEquals(
        connectionManager, carFeaturesOffHeapIndex.getConnectionManager(new QueryOptions()));
  }
コード例 #2
0
  @Test
  public void testGetConnectionManager_NonStandalone() {

    ConnectionManager connectionManager = mock(ConnectionManager.class);
    QueryOptions queryOptions = mock(QueryOptions.class);
    when(queryOptions.get(ConnectionManager.class)).thenReturn(connectionManager);

    SQLiteIndex<String, Car, Integer> carFeaturesOffHeapIndex =
        new SQLiteIndex<String, Car, Integer>(Car.FEATURES, OBJECT_TO_ID, ID_TO_OBJECT, null);

    assertEquals(connectionManager, carFeaturesOffHeapIndex.getConnectionManager(queryOptions));
  }