Add a commmand validator.
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
package space.kklochko.jdbc_hospital_example.cli.validators
|
||||
|
||||
import spock.lang.Specification
|
||||
import spock.lang.Subject
|
||||
|
||||
class CommandValidatorSpec extends Specification {
|
||||
def "Parser parse the commands"() {
|
||||
given: "I have the validator"
|
||||
@Subject
|
||||
def validator = new CommandValidator(command)
|
||||
|
||||
when: "check if valid"
|
||||
boolean status = validator.isValid()
|
||||
|
||||
then: "the result must be as expected"
|
||||
status == expectedStatus
|
||||
|
||||
where:
|
||||
command || expectedStatus
|
||||
"insert indicator(id='1', type='blood', values='Good samples.', timestamp='2023-10-17 14:30:00')" || true
|
||||
"insert indicator(id='1', type='blood, blood', values='Good samples.', timestamp='2023-10-17 14:30:00')" || true
|
||||
"update indicator(id='1', type='blood, blood', values='Good samples.', timestamp='2023-10-17 14:30:00')" || true
|
||||
"remove indicator(id='1', type='blood, blood', values='Good samples.', timestamp='2023-10-17 14:30:00')" || true
|
||||
"readAll indicator()" || true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user