/** * Creates a new instance. * @param callerClass the caller class (for detecting testing resources) * @param context the current testing context */ public BatchTestTool(Class<?> callerClass, TestContext context) { this(callerClass, context, new TestToolRepository(context.getClassLoader())); }
private Difference verify(Object key, DataModelReflection expected, DataModelReflection actual) { assert key != null; assert expected != null || actual != null; Object result = rule.verify(expected, actual); if (result == null) { return null; } return new Difference(expected, actual, result); } }
@Override public void validate() throws IOException { VerifyEngine engine = new VerifyEngine(rule); try { engine.addExpected(expected); } finally { expected.close(); } }
private Difference createDifference(long actual) { PropertyName name = PropertyName.newInstance("count"); return new Difference( new DataModelReflection(Collections.singletonMap(name, expected)), new DataModelReflection(Collections.singletonMap(name, actual)), "count verification was failed"); }
@Override public <T> DataModelSource createSource( DataModelDefinition<T> definition, TestContext context) throws IOException { return DataModelSourceFilter.this.apply(factory.createSource(definition, context)); } };
private <T> void prepare( DataModelDefinition<T> definition, ImporterDescription description, DataModelSourceFactory source) throws IOException { assert definition != null; assert description != null; assert source != null; ModelOutput< T> output = getDriver(description).createOutput(definition, description, context); prepare(definition, output, source); }
private <T> void prepare( DataModelDefinition<T> definition, ExporterDescription desctipion, DataModelSourceFactory source) throws IOException { assert definition != null; assert desctipion != null; assert source != null; ModelOutput<T> output = getDriver(desctipion).createOutput(definition, desctipion, context); prepare(definition, output, source); }
private T convert(DataModelReflection reflection) { if (reflection == null) { return null; } return definition.toObject(reflection); } }
/** * Returns the created model. * @return the created model object */ public DataModelReflection getReflection() { return engine.builder.build(); }
private <T> void prepare( DataModelDefinition<T> definition, ImporterDescription desctipion, URI source) throws IOException { assert definition != null; assert desctipion != null; assert source != null; ModelOutput<T> output = importers.createOutput(definition, desctipion, context); prepare(definition, output, source); }
private <T> void prepare( DataModelDefinition<T> definition, ExporterDescription desctipion, URI source) throws IOException { assert definition != null; assert desctipion != null; assert source != null; ModelOutput<T> output = exporters.createOutput(definition, desctipion, context); prepare(definition, output, source); }
/** * Invoked each {@link BigDecimal} property. * @param name property name * @param context context object (specified in {@link #scan(DataModelDefinition, Object)}) * @throws E if failed */ public void decimalProperty(PropertyName name, C context) throws E { anyProperty(name, context); }
/** * Creates a new instance which uses registerd services. * @param serviceClassLoader class loader to load services * @throws IllegalArgumentException if some parameters were {@code null} */ public TestResultInspector(ClassLoader serviceClassLoader) { this(new TestContext.Empty(), serviceClassLoader); }
private Difference createDifference(long actual) { PropertyName name = PropertyName.newInstance("count"); return new Difference( new DataModelReflection(Collections.singletonMap(name, expected)), new DataModelReflection(Collections.singletonMap(name, actual)), "count verification was failed"); }
/** * Invoked each {@link PropertyType#TIME} property. * @param name property name * @param context context object (specified in {@link #scan(DataModelDefinition, Object)}) * @throws E if failed */ public void timeProperty(PropertyName name, C context) throws E { anyProperty(name, context); }
private Difference createDifference(long actual) { PropertyName name = PropertyName.newInstance("count"); return new Difference( new DataModelReflection(Collections.singletonMap(name, expected)), new DataModelReflection(Collections.singletonMap(name, actual)), "count verification was failed"); }
private Difference createDifference(long actual) { PropertyName name = PropertyName.newInstance("count"); return new Difference( new DataModelReflection(Collections.singletonMap(name, expected)), new DataModelReflection(Collections.singletonMap(name, actual)), "count verification was failed"); }