-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/fdp 1815 #12
Feature/fdp 1815 #12
Conversation
Signed-off-by: Luciano Favoroso <[email protected]>
Signed-off-by: Luciano Favoroso <[email protected]>
Signed-off-by: Luciano Favoroso <[email protected]>
Signed-off-by: Luciano Favoroso <[email protected]>
Signed-off-by: Luciano Favoroso <[email protected]>
application/src/main/kotlin/org/gxf/crestdevicesimulator/simulator/response/PskKeyExtractor.kt
Outdated
Show resolved
Hide resolved
application/src/main/kotlin/org/gxf/crestdevicesimulator/simulator/response/PskKeyExtractor.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/org/gxf/crestdevicesimulator/simulator/response/command/PskCommandHandler.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/org/gxf/crestdevicesimulator/simulator/response/command/PskCommandHandler.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: Luciano Favoroso <[email protected]>
...rg/gxf/crestdevicesimulator/simulator/response/command/exception/PskHashNotValidException.kt
Outdated
Show resolved
Hide resolved
application/src/main/kotlin/org/gxf/crestdevicesimulator/simulator/response/PskKeyExtractor.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: Luciano Favoroso <[email protected]>
Signed-off-by: Luciano Favoroso <[email protected]>
Signed-off-by: Luciano Favoroso <[email protected]>
...rg/gxf/crestdevicesimulator/simulator/response/command/exception/PskHashNotValidException.kt
Outdated
Show resolved
Hide resolved
application/src/test/kotlin/org/gxf/crestdevicesimulator/simulator/response/PskExtractorTest.kt
Show resolved
Hide resolved
application/src/test/kotlin/org/gxf/crestdevicesimulator/simulator/response/PskExtractorTest.kt
Outdated
Show resolved
Hide resolved
application/src/test/kotlin/org/gxf/crestdevicesimulator/simulator/response/PskExtractorTest.kt
Outdated
Show resolved
Hide resolved
application/src/test/kotlin/org/gxf/crestdevicesimulator/simulator/response/PskExtractorTest.kt
Outdated
Show resolved
Hide resolved
application/src/test/kotlin/org/gxf/crestdevicesimulator/simulator/response/PskExtractorTest.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/org/gxf/crestdevicesimulator/simulator/response/command/PskCommandHandler.kt
Show resolved
Hide resolved
application/src/test/kotlin/org/gxf/crestdevicesimulator/simulator/response/PskExtractorTest.kt
Show resolved
Hide resolved
Signed-off-by: Luciano Favoroso <[email protected]>
Signed-off-by: Luciano Favoroso <[email protected]>
fun extractKeyFromCommand(command: String) = pskKeyHashSplitterRegex.findAll(command).first().groups[1]!!.value | ||
|
||
fun extractHashFromCommand(command: String) = pskKeyHashSplitterRegex.findAll(command).first().groups[2]!!.value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather have one regex findAll instead of 2 but for the simulator this could be good enough
@InjectMocks | ||
private lateinit var pskCommandHandler: PskCommandHandler | ||
|
||
private val key = "1234567891234567" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect to see an old and a new key in this test.
@BeforeEach | ||
fun setup() { | ||
`when`(simulatorProperties.pskIdentity).thenReturn(identity) | ||
`when`(pskRepository.findById(any())).thenReturn(Optional.of(PreSharedKey(identity, key, secret))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here return a PSK with an old key
|
||
assertThatExceptionOfType(InvalidPskHashException::class.java).isThrownBy { | ||
pskCommandHandler.handlePskChange(pskCommand) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to have separate sections for act and assert.
Consider adding some verification that both repository and store are not changed as well.
pskCommandHandler.handlePskChange(pskCommand) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add newline at end of file
Signed-off-by: Luciano Favoroso <[email protected]>
9417ae3
|
No description provided.