Skip to content

Commit fb96ced

Browse files
authored
Merge pull request #587 from josdem/feature/556
[small]Feature/556
2 parents 2555af5 + 3b85732 commit fb96ced

File tree

3 files changed

+49
-56
lines changed

3 files changed

+49
-56
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ val cglibVersion by extra("3.3.0")
2929
val mockitoKotlinVersion by extra("5.4.0")
3030

3131
group = "com.josdem.vetlog"
32-
version = "2.5.5.1"
32+
version = "2.6.0"
3333

3434
configurations {
3535
compileOnly {

src/test/java/com/josdem/vetlog/model/RegistrationCodeTest.java

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
Copyright 2025 Jose Morales [email protected]
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package com.josdem.vetlog.model
18+
19+
import com.josdem.vetlog.enums.RegistrationCodeStatus
20+
import org.junit.jupiter.api.Test
21+
import org.junit.jupiter.api.TestInfo
22+
import org.slf4j.LoggerFactory
23+
import java.time.LocalDateTime
24+
import java.time.temporal.ChronoUnit
25+
import kotlin.test.assertEquals
26+
import kotlin.test.assertFalse
27+
import kotlin.test.assertTrue
28+
29+
internal class RegistrationCodeTest {
30+
private val registrationCode: RegistrationCode = RegistrationCode()
31+
32+
private val log = LoggerFactory.getLogger(this::class.java)
33+
34+
@Test
35+
fun `should generate registration code`(testInfo: TestInfo) {
36+
log.info(testInfo.displayName)
37+
assertEquals(7, ChronoUnit.DAYS.between(registrationCode.dateCreated, LocalDateTime.now().plusDays(7)))
38+
assertEquals(36, registrationCode.token.length)
39+
assertTrue { registrationCode.isValid }
40+
}
41+
42+
@Test
43+
fun `should invalidate token`(testInfo: TestInfo) {
44+
log.info(testInfo.displayName)
45+
registrationCode.status = RegistrationCodeStatus.INVALID
46+
assertFalse { registrationCode.isValid }
47+
}
48+
}

0 commit comments

Comments
 (0)