File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
main/java/org/spine3/test
test/java/org/spine3/test Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 2121package org .spine3 .test ;
2222
2323import com .google .protobuf .Timestamp ;
24+ import org .spine3 .base .Identifiers ;
2425import org .spine3 .protobuf .Timestamps ;
2526import org .spine3 .users .UserId ;
2627
@@ -114,6 +115,13 @@ public static UserId newUserId(String value) {
114115 .build ();
115116 }
116117
118+ /**
119+ * Generates a new UUID-based {@code UserId}.
120+ */
121+ public static UserId newUserUuid () {
122+ return newUserId (Identifiers .newUuid ());
123+ }
124+
117125 /** The provider of current time, which is always the same. */
118126 public static class FrozenMadHatterParty implements Timestamps .Provider {
119127 private final Timestamp frozenTime ;
Original file line number Diff line number Diff line change @@ -84,6 +84,11 @@ public void create_UserId_by_string() {
8484 assertEquals (expected , userId );
8585 }
8686
87+ @ Test
88+ public void create_new_UUID_based_UserId () {
89+ assertFalse (Tests .newUserUuid ().getValue ().isEmpty ());
90+ }
91+
8792 @ Test (expected = NullPointerException .class )
8893 public void do_not_accept_null_UseId_value () {
8994 newUserId (Tests .<String >nullRef ());
You can’t perform that action at this time.
0 commit comments