Skip to content

Commit 758a42f

Browse files
committed
convert BPConstraintGeneratorTest main into a test
Signed-off-by: Lee Surprenant <[email protected]>
1 parent 3e6c4b6 commit 758a42f

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

fhir-profile/src/test/java/com/ibm/fhir/profile/test/BPConstraintGeneratorTest.java

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@
77
package com.ibm.fhir.profile.test;
88

99
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;
1410

1511
import org.testng.annotations.BeforeClass;
12+
import org.testng.annotations.Test;
1613

1714
import com.ibm.fhir.model.annotation.Constraint;
1815
import com.ibm.fhir.model.resource.StructureDefinition;
@@ -21,34 +18,23 @@
2118
import com.ibm.fhir.registry.FHIRRegistry;
2219

2320
public class BPConstraintGeneratorTest {
21+
private static final boolean DEBUG = true;
22+
2423
@BeforeClass
2524
public void before() {
2625
FHIRRegistry.getInstance();
2726
FHIRRegistry.init();
2827
}
2928

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 {
4931
StructureDefinition profile = ProfileSupport.getProfile("http://hl7.org/fhir/StructureDefinition/bp");
5032
ConstraintGenerator generator = new ConstraintGenerator(profile);
5133
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+
}
5339
}
5440
}

0 commit comments

Comments
 (0)