Skip to content

Commit

Permalink
Naming improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek2010 committed May 11, 2021
1 parent 077ffaa commit 45a2762
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ private void initializeMapFrameworks() {
}

private void importExistingProjectIfNeeded() {
if (!appStateProvider.isFreshInstall() && !metaSettings.getBoolean(MetaKeys.ALREADY_TRIED_TO_IMPORT_EXISTING_PROJECT)) {
if (!appStateProvider.isFreshInstall() && !metaSettings.getBoolean(MetaKeys.EXISTING_PROJECT_IMPORTED)) {
projectImporter.importExistingProject();
}
metaSettings.save(MetaKeys.ALREADY_TRIED_TO_IMPORT_EXISTING_PROJECT, true);
metaSettings.save(MetaKeys.EXISTING_PROJECT_IMPORTED, true);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class MetaKeys {
public static final String CURRENT_PROJECT_ID = "current_project_id";
public static final String KEY_PROJECTS = "projects";
public static final String FIRST_LAUNCH = "first_launch";
public static final String ALREADY_TRIED_TO_IMPORT_EXISTING_PROJECT = "already_tried_to_import_existing_project";
public static final String EXISTING_PROJECT_IMPORTED = "existing_project_imported";

private MetaKeys() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ApplicationInitializerTest {
@Test
fun `Should existing project be imported when it's not first launch and it has not been already imported`() {
`when`(appStateProvider.isFreshInstall()).thenReturn(false)
TestSettingsProvider.getMetaSettings().save(MetaKeys.ALREADY_TRIED_TO_IMPORT_EXISTING_PROJECT, false)
TestSettingsProvider.getMetaSettings().save(MetaKeys.EXISTING_PROJECT_IMPORTED, false)
applicationInitializer.initialize()
verify(projectImporter).importExistingProject()
}
Expand All @@ -63,15 +63,15 @@ class ApplicationInitializerTest {
@Test
fun `Should not existing project be imported when it was already imported once`() {
`when`(appStateProvider.isFreshInstall()).thenReturn(false)
TestSettingsProvider.getMetaSettings().save(MetaKeys.ALREADY_TRIED_TO_IMPORT_EXISTING_PROJECT, true)
TestSettingsProvider.getMetaSettings().save(MetaKeys.EXISTING_PROJECT_IMPORTED, true)
applicationInitializer.initialize()
verifyNoInteractions(projectImporter)
}

@Test
fun `Initializing the app should set ALREADY_TRIED_TO_IMPORT_EXISTING_PROJECT flag to true`() {
TestSettingsProvider.getMetaSettings().save(MetaKeys.ALREADY_TRIED_TO_IMPORT_EXISTING_PROJECT, false)
TestSettingsProvider.getMetaSettings().save(MetaKeys.EXISTING_PROJECT_IMPORTED, false)
applicationInitializer.initialize()
assertThat(TestSettingsProvider.getMetaSettings().getBoolean(MetaKeys.ALREADY_TRIED_TO_IMPORT_EXISTING_PROJECT), equalTo(true))
assertThat(TestSettingsProvider.getMetaSettings().getBoolean(MetaKeys.EXISTING_PROJECT_IMPORTED), equalTo(true))
}
}

0 comments on commit 45a2762

Please sign in to comment.