mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Fix UUID generation
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
package org.isoron.uhabits.core.models
|
||||
|
||||
import org.isoron.uhabits.core.utils.*
|
||||
import java.util.*
|
||||
|
||||
data class Habit(
|
||||
var color: PaletteColor = PaletteColor(8),
|
||||
@@ -40,6 +41,10 @@ data class Habit(
|
||||
val scores: ScoreList,
|
||||
val streaks: StreakList,
|
||||
) {
|
||||
init {
|
||||
if(uuid == null) this.uuid = UUID.randomUUID().toString().replace("-", "");
|
||||
}
|
||||
|
||||
var observable = ModelObservable()
|
||||
|
||||
val isNumerical: Boolean
|
||||
|
||||
@@ -40,6 +40,16 @@ public class HabitTest extends BaseUnitTest
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUuidGeneration()
|
||||
{
|
||||
Habit habit1 = modelFactory.buildHabit();
|
||||
Habit habit2 = modelFactory.buildHabit();
|
||||
assertNotNull(habit1.getUuid());
|
||||
assertNotNull(habit2.getUuid());
|
||||
assertNotEquals(habit1.getUuid(), habit2.getUuid());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_copyAttributes()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user