-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INJIMOB-2160] add UUID as id to mdoc data
Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>
- Loading branch information
1 parent
14d4d7c
commit 0024b3f
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
mock-certify-plugin/src/main/java/io/mosip/certify/util/UUIDGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.mosip.certify.util; | ||
|
||
import java.util.UUID; | ||
|
||
public class UUIDGenerator { | ||
public String generate() { | ||
return "urn:uuid:" + UUID.randomUUID(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
mock-certify-plugin/src/test/java/io/mosip/certify/util/UUIDGeneratorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.mosip.certify.util; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
class UUIDGeneratorTest { | ||
@Test | ||
void shouldReturnUUIDInRequiredFormatWhenGenerated() { | ||
String generatedUUID = new UUIDGenerator().generate(); | ||
|
||
assertTrue(generatedUUID.matches("^urn:uuid:[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$")); | ||
} | ||
} |