@Test public void returnsTheGeneratedAndStoredUUIDAfterGettingIt() { UUIDGenerator generator = givenAGenerator(); generator.getUUID(); String storedUUID = getUUIDGeneratorSharedPreferences().getString(UUID_KEY, ""); assertEquals(storedUUID, generator.getUUID()); }
String getUUID() { String uuid = ""; synchronized (GENERATOR_LOCK) { uuid = getUUIDFromSharedPreferences(); if (uuid.isEmpty()) { uuid = generateAndSaveUUID(); } } return uuid; }
UUIDGenerator { String getUUID() { String uuid = ""; synchronized (GENERATOR_LOCK) { uuid = getUUIDFromSharedPreferences(); if (uuid.isEmpty()) { uuid = generateAndSaveUUID(); } } return uuid; } }
UUIDGenerator { String getUUID() { String uuid = ""; synchronized (GENERATOR_LOCK) { uuid = getUUIDFromSharedPreferences(); if (uuid.isEmpty()) { uuid = generateAndSaveUUID(); } } return uuid; } UUIDGenerator(Context context); }
UUIDGenerator { String getUUID() { String uuid = ""; synchronized (GENERATOR_LOCK) { uuid = getUUIDFromSharedPreferences(); if (uuid.isEmpty()) { uuid = generateAndSaveUUID(); } } return uuid; } UUIDGenerator(Context context);  }
UUIDGenerator { String getUUID() { String uuid = ""; synchronized (GENERATOR_LOCK) { uuid = getUUIDFromSharedPreferences(); if (uuid.isEmpty()) { uuid = generateAndSaveUUID(); } } return uuid; } UUIDGenerator(Context context);   }