Search in sources :

Example 1 with CheckBase

use of org.revapi.java.spi.CheckBase in project revapi by revapi.

the class CheckSpecificConfigurationTest method testCheckConfigurationInSchema.

@Test
public void testCheckConfigurationInSchema() throws Exception {
    class FakeCheck extends CheckBase {

        @Override
        public EnumSet<Type> getInterest() {
            return null;
        }

        @Nullable
        @Override
        public String getExtensionId() {
            return "testCheck";
        }

        @Nullable
        @Override
        public Reader getJSONSchema() {
            return new StringReader("{\"type\": \"boolean\"}");
        }
    }
    JavaApiAnalyzer analyzer = new JavaApiAnalyzer(Collections.singleton(new FakeCheck()));
    try (Reader rdr = analyzer.getJSONSchema()) {
        ModelNode schema = ModelNode.fromJSONString(slurp(rdr));
        Assert.assertTrue("boolean".equals(schema.get("properties", "checks", "properties", "testCheck", "type").asString()));
    }
}
Also used : CheckBase(org.revapi.java.spi.CheckBase) StringReader(java.io.StringReader) StringReader(java.io.StringReader) Reader(java.io.Reader) ModelNode(org.jboss.dmr.ModelNode) Test(org.junit.Test)

Aggregations

Reader (java.io.Reader)1 StringReader (java.io.StringReader)1 ModelNode (org.jboss.dmr.ModelNode)1 Test (org.junit.Test)1 CheckBase (org.revapi.java.spi.CheckBase)1