-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add timestamp to liveness image filename (#14)
* add timestamp to liveness image filename * Update Util.kt * Update UtilTest.kt
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
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
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,21 @@ | ||
package com.smileidentity.ui.core | ||
|
||
import org.junit.Assert.assertTrue | ||
import org.junit.Test | ||
|
||
class UtilTest { | ||
|
||
@Test | ||
fun `should add timestamp to filename`() { | ||
val file = createLivenessFile() | ||
// name is si_liveness_{timestamp}_{random_indentifier}.jpg | ||
val stringTokens = file.name.split("_") | ||
val timestamp = stringTokens[stringTokens.size - 2] | ||
val timestampLong = timestamp.toLong() | ||
assertTrue( | ||
timestampLong in ( | ||
System.currentTimeMillis() - 1000 | ||
)..(System.currentTimeMillis()), | ||
) | ||
} | ||
} |