BackendProperties { @Nullable public String getProjectId() { if (isOnAppEngine()) { return null; } else { return envReader.getenv(PROJECT_ID_PROPERTY); } } BackendProperties(); @VisibleForTesting  BackendProperties(boolean isAppEngine, EnvReader envReader); boolean isOnAppEngine(); long getProjectNumber(); @Nullable String getProjectId(); @Nullable String getApplicationId();  }
@Test public void testGetProjectId_appEngine() { assertNull(appEngineProperties.getProjectId()); }
@Test public void testGetProjectId_tornado() { assertEquals(PROJECT_ID, properties.getProjectId()); }
@Test public void testGetProjectId_tornado_notSet() { Mockito.when(envReader.getenv(BackendProperties.PROJECT_ID_PROPERTY)).thenReturn(null); assertNull(properties.getProjectId()); }