|
7 | 7 | package com.ibm.fhir.profile.test; |
8 | 8 |
|
9 | 9 | import java.util.List; |
10 | | -import java.util.logging.Handler; |
11 | | -import java.util.logging.Level; |
12 | | -import java.util.logging.LogRecord; |
13 | | -import java.util.logging.Logger; |
14 | 10 |
|
15 | 11 | import org.testng.annotations.BeforeClass; |
| 12 | +import org.testng.annotations.Test; |
16 | 13 |
|
17 | 14 | import com.ibm.fhir.model.annotation.Constraint; |
18 | 15 | import com.ibm.fhir.model.resource.StructureDefinition; |
|
21 | 18 | import com.ibm.fhir.registry.FHIRRegistry; |
22 | 19 |
|
23 | 20 | public class BPConstraintGeneratorTest { |
| 21 | + private static final boolean DEBUG = true; |
| 22 | + |
24 | 23 | @BeforeClass |
25 | 24 | public void before() { |
26 | 25 | FHIRRegistry.getInstance(); |
27 | 26 | FHIRRegistry.init(); |
28 | 27 | } |
29 | 28 |
|
30 | | - public static void main(String[] args) throws Exception { |
31 | | - Logger logger = Logger.getLogger(ConstraintGenerator.class.getName()); |
32 | | - logger.setLevel(Level.FINEST); |
33 | | - Handler handler = new Handler() { |
34 | | - @Override |
35 | | - public void publish(LogRecord record) { |
36 | | - System.out.println(record.getMessage()); |
37 | | - } |
38 | | - |
39 | | - @Override |
40 | | - public void flush() { |
41 | | - System.out.flush(); |
42 | | - } |
43 | | - |
44 | | - @Override |
45 | | - public void close() throws SecurityException { } |
46 | | - }; |
47 | | - handler.setLevel(Level.FINEST); |
48 | | - logger.addHandler(handler); |
| 29 | + @Test |
| 30 | + public void generateConstraints() throws Exception { |
49 | 31 | StructureDefinition profile = ProfileSupport.getProfile("http://hl7.org/fhir/StructureDefinition/bp"); |
50 | 32 | ConstraintGenerator generator = new ConstraintGenerator(profile); |
51 | 33 | List<Constraint> constraints = generator.generate(); |
52 | | - constraints.forEach(System.out::println); |
| 34 | + for (Constraint constraint : constraints) { |
| 35 | + if (DEBUG) { |
| 36 | + System.out.println(constraint.id() + "\t" + constraint.expression()); |
| 37 | + } |
| 38 | + } |
53 | 39 | } |
54 | 40 | } |
0 commit comments