@Test public void returnsTheSameUUIDEvenIfTheGeneratorInstancesAreDifferent() { UUIDGenerator generator1 = givenAGenerator(); UUIDGenerator generator2 = givenAGenerator(); String firstUUIDCall = generator1.getUUID(); String secondUUIDCall = generator2.getUUID(); assertEquals(firstUUIDCall, secondUUIDCall); }
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);   }