@@ -0,0 +1,2477 @@
+package com.google.android.gnd.repository;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertNull;%0A%0Aimport com.google.android.gnd.model.Project;%0Aimport com.google.android.gnd.model.feature.Feature;%0Aimport com.google.android.gnd.model.feature.Point;%0Aimport com.google.android.gnd.model.layer.Layer;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Apublic class InMemoryCacheTest %7B%0A%0A  private InMemoryCache inMemoryCache;%0A  private Project project;%0A  private Feature feature;%0A%0A  @Before%0A  public void setUp() %7B%0A    inMemoryCache = new InMemoryCache();%0A%0A    project =%0A        Project.newBuilder()%0A            .setId(%22foo project id%22)%0A            .setTitle(%22foo title%22)%0A            .setDescription(%22foo description%22)%0A            .build();%0A%0A    feature =%0A        Feature.newBuilder()%0A            .setId(%22foo feature id%22)%0A            .setProject(Project.newBuilder().build())%0A            .setLayer(Layer.newBuilder().build())%0A            .setPoint(Point.newBuilder().setLatitude(0.0).setLongitude(0.0).build())%0A            .build();%0A  %7D%0A%0A  @Test%0A  public void testSaveFeatures() %7B%0A    assertEquals(0, inMemoryCache.getFeatures().size());%0A%0A    inMemoryCache.putFeature(feature);%0A%0A    assertEquals(1, inMemoryCache.getFeatures().size());%0A    assertEquals(feature, inMemoryCache.getFeatures().asList().get(0));%0A  %7D%0A%0A  @Test%0A  public void testDeleteFeatures() %7B%0A    inMemoryCache.putFeature(feature);%0A%0A    assertEquals(1, inMemoryCache.getFeatures().size());%0A%0A    // remove feature%0A    inMemoryCache.removeFeature(feature.getId());%0A%0A    assertEquals(0, inMemoryCache.getFeatures().size());%0A  %7D%0A%0A  @Test%0A  public void testSaveActiveProject() %7B%0A    inMemoryCache.putFeature(feature);%0A%0A    assertEquals(1, inMemoryCache.getFeatures().size());%0A    assertNull(inMemoryCache.getActiveProject());%0A%0A    // save project%0A    inMemoryCache.setActiveProject(project);%0A%0A    assertEquals(project, inMemoryCache.getActiveProject());%0A    assertEquals(0, inMemoryCache.getFeatures().size());%0A  %7D%0A%0A  @Test%0A  public void testRemoveActiveProject() %7B%0A    inMemoryCache.setActiveProject(project);%0A    inMemoryCache.putFeature(feature);%0A%0A    assertNotNull(inMemoryCache.getActiveProject());%0A    assertEquals(1, inMemoryCache.getFeatures().size());%0A%0A    // remove saved project%0A    inMemoryCache.clearActiveProject();%0A%0A    assertNull(inMemoryCache.getActiveProject());%0A    assertEquals(0, inMemoryCache.getFeatures().size());%0A  %7D%0A%7D%0A

Add tests for InMemoryCacheTest