This repository was archived by the owner on Feb 15, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
validator/src/test/java/io/adminshell/aas/v3/model/validator Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package io .adminshell .aas .v3 .model .validator ;
2+
3+ import io .adminshell .aas .v3 .model .Referable ;
4+ import org .junit .Test ;
5+
6+ import java .util .ArrayList ;
7+
8+ import static org .junit .Assert .assertTrue ;
9+ import static org .junit .Assert .fail ;
10+
11+ /**
12+ * Tests the following constraint:
13+ * <p>
14+ * <i> An attribute with data type "string" is not allowed to be empty. </i>
15+ * </p>
16+ *
17+ * @author bader, chang
18+ *
19+ */
20+
21+ public class TestAASd_100 {
22+ @ Test
23+ public void idShortWithNotAllowedCharacters () throws ValidationException {
24+ Referable wrongReferable = ConstraintTestHelper .createSubmodel (new ArrayList <>());
25+
26+
27+ wrongReferable .setIdShort ("" );
28+ try {
29+ ShaclValidator .getInstance ().validate (wrongReferable );
30+ fail ();
31+ } catch (ValidationException e ) {
32+ assertTrue (e .getMessage ().endsWith ("starting mandatory with a letter. I.e. [a-zA-Z][a-zA-Z0-9_]+." ));
33+ }
34+
35+
36+ }
37+
38+ @ Test
39+ public void idShortWithAllowedCharacters () throws ValidationException {
40+ Referable referable = ConstraintTestHelper .createSubmodel (new ArrayList <>());
41+ referable .setIdShort ("id_Short" );
42+ ShaclValidator .getInstance ().validate (referable );
43+ }
44+ }
You can’t perform that action at this time.
0 commit comments