forked from openEHR/java-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add validation check to ensure that the description/details are prese…
…nt for the original language as well as all translations.
- Loading branch information
Showing
6 changed files
with
138 additions
and
66 deletions.
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
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
112 changes: 59 additions & 53 deletions
112
...etype-validator/src/test/java/org/openehr/am/validation/OntologyTranslationCheckTest.java
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 |
---|---|---|
@@ -1,53 +1,59 @@ | ||
package org.openehr.am.validation; | ||
|
||
public class OntologyTranslationCheckTest extends ArchetypeValidationTestBase { | ||
|
||
public void testTranslationCheckWithNoTranslation() throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v1"); | ||
assertEquals("expected no validation error", 0, errors.size()); | ||
} | ||
|
||
public void testTranslationCheckWithoutConstraintDef() throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v7"); | ||
assertEquals("expected no validation error", 0, errors.size()); | ||
} | ||
|
||
public void testTranslationCheckWithMissingTermAndConstraintTranslation() | ||
throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v2"); | ||
assertEquals("expected validation error", 2, errors.size()); | ||
assertFirstErrorType(ErrorType.VOTM); | ||
assertSecondErrorType(ErrorType.VOTM); | ||
} | ||
|
||
public void testTranslationCheckWithMissingTermTranslation() | ||
throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v3"); | ||
assertEquals("expected validation error", 1, errors.size()); | ||
assertFirstErrorType(ErrorType.VOTM); | ||
} | ||
|
||
public void testTranslationCheckWithMissingConstraintTranslation() | ||
throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v4"); | ||
assertEquals("expected validation error", 1, errors.size()); | ||
assertFirstErrorType(ErrorType.VOTM); | ||
} | ||
|
||
public void testTranslationCheckWithCompleteTranslation() throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v5"); | ||
assertEquals("expected no validation error", 0, errors.size()); | ||
} | ||
|
||
public void testTranslationCheckWithTwoMissingTranslation() throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v6"); | ||
assertEquals("expected validation error", 2, errors.size()); | ||
assertFirstErrorType(ErrorType.VOTM); | ||
assertSecondErrorType(ErrorType.VOTM); | ||
} | ||
|
||
private void checkTranslation(String name) throws Exception { | ||
archetype = loadArchetype(name); | ||
validator.checkOntologyTranslation(archetype, errors); | ||
} | ||
} | ||
package org.openehr.am.validation; | ||
|
||
public class OntologyTranslationCheckTest extends ArchetypeValidationTestBase { | ||
|
||
public void testTranslationCheckWithNoTranslation() throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v1"); | ||
assertEquals("expected no validation error", 0, errors.size()); | ||
} | ||
|
||
public void testTranslationCheckWithoutConstraintDef() throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v7"); | ||
assertEquals("expected no validation error", 0, errors.size()); | ||
} | ||
|
||
public void testTranslationCheckWithMissingTermAndConstraintTranslation() | ||
throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v2"); | ||
assertEquals("expected validation error", 2, errors.size()); | ||
assertFirstErrorType(ErrorType.VOTM); | ||
assertSecondErrorType(ErrorType.VOTM); | ||
} | ||
|
||
public void testTranslationCheckWithMissingTermTranslation() | ||
throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v3"); | ||
assertEquals("expected validation error", 1, errors.size()); | ||
assertFirstErrorType(ErrorType.VOTM); | ||
} | ||
|
||
public void testTranslationCheckWithMissingConstraintTranslation() | ||
throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v4"); | ||
assertEquals("expected validation error", 1, errors.size()); | ||
assertFirstErrorType(ErrorType.VOTM); | ||
} | ||
|
||
public void testTranslationCheckWithCompleteTranslation() throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v5"); | ||
assertEquals("expected no validation error", 0, errors.size()); | ||
} | ||
|
||
public void testTranslationCheckWithTwoMissingTranslation() throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v6"); | ||
assertEquals("expected validation error", 2, errors.size()); | ||
assertFirstErrorType(ErrorType.VOTM); | ||
assertSecondErrorType(ErrorType.VOTM); | ||
} | ||
|
||
public void testTranslationCheckWithoutMatchingDescriptionDetails() throws Exception { | ||
checkTranslation("adl-test-ENTRY.ontology_translation.v8"); | ||
assertEquals("expected validation error", 1, errors.size()); | ||
assertFirstErrorType(ErrorType.VOTM); | ||
} | ||
|
||
private void checkTranslation(String name) throws Exception { | ||
archetype = loadArchetype(name); | ||
validator.checkOntologyTranslation(archetype, errors); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
archetype-validator/src/test/resources/adl-test-ENTRY.ontology_translation.v8
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,58 @@ | ||
archetype | ||
adl-test-ENTRY.ontology_translation.v7 | ||
|
||
concept | ||
[at0000] -- empty definition test | ||
|
||
language | ||
original_language = <[ISO_639-1::en]> | ||
translations = < | ||
["de"] = < | ||
language = <[ISO_639-1::de]> | ||
author = < | ||
["name"] = <"Jasmin Buck, Sebastian Garde"> | ||
["organisation"] = <"University of Heidelberg, Central Queensland University"> | ||
> | ||
> | ||
> | ||
description | ||
original_author = < | ||
["name"] = <"Tester test"> | ||
> | ||
details = < | ||
["en"] = < | ||
language = <[ISO_639-1::de]> | ||
purpose = <"Test"> | ||
use = <"To test a missing German details equivalent."> | ||
> | ||
|
||
> | ||
lifecycle_state = <"draft"> | ||
definition | ||
ELEMENT[at0000] matches { -- Diagnosis | ||
value matches { | ||
DV_CODED_TEXT matches { | ||
defining_code matches {*} | ||
} | ||
} | ||
} | ||
|
||
ontology | ||
term_definitions = < | ||
["en"] = < | ||
items = < | ||
["at0000"] = < | ||
text = <"most minimal">; | ||
description = <"most minimal"> | ||
> | ||
> | ||
> | ||
["de"] = < | ||
items = < | ||
["at0000"] = < | ||
text = <"most minimal">; | ||
description = <"most minimal"> | ||
> | ||
> | ||
> | ||
> |