### Question:
PSPreprocessor { @Nullable public PSSchema getAsMinimalSchema (@Nonnull final PSSchema aSchema) throws SchematronPreprocessException { ValueEnforcer.notNull (aSchema, "Schema"); if (aSchema.isMinimal ()) return aSchema; return getForcedPreprocessedSchema (aSchema); } PSPreprocessor(@Nonnull final IPSQueryBinding aQueryBinding); @Nonnull IPSQueryBinding getQueryBinding(); boolean isKeepTitles(); @Nonnull PSPreprocessor setKeepTitles(final boolean bKeepTitles); boolean isKeepDiagnostics(); @Nonnull PSPreprocessor setKeepDiagnostics(final boolean bKeepDiagnostics); boolean isKeepReports(); @Nonnull PSPreprocessor setKeepReports(final boolean bKeepReports); boolean isKeepEmptyPatterns(); @Nonnull PSPreprocessor setKeepEmptyPatterns(final boolean bKeepEmptyPatterns); boolean isKeepEmptySchema(); @Nonnull PSPreprocessor setKeepEmptySchema(final boolean bKeepEmptySchema); @Nullable PSSchema getAsMinimalSchema(@Nonnull final PSSchema aSchema); @Nullable PSSchema getAsPreprocessedSchema(@Nonnull final PSSchema aSchema); @Nullable PSSchema getForcedPreprocessedSchema(@Nonnull final PSSchema aSchema); @Override String toString(); @Nonnull static PSPreprocessor createPreprocessorWithoutInformationLoss(@Nonnull final IPSQueryBinding aQueryBinding); static final boolean DEFAULT_KEEP_TITLES; static final boolean DEFAULT_KEEP_DIAGNOSTICS; static final boolean DEFAULT_KEEP_REPORTS; static final boolean DEFAULT_KEEP_EMPTY_PATTERNS; static final boolean DEFAULT_KEEP_EMPTY_SCHEMA; }### Answer:
@Test public void testBasic () throws Exception { final PSPreprocessor aPreprocessor = new PSPreprocessor (PSXPathQueryBinding.getInstance ()); for (final IReadableResource aRes : SchematronTestHelper.getAllValidSchematronFiles ()) { final IMicroDocument aDoc = SchematronHelper.getWithResolvedSchematronIncludes (aRes, false); assertNotNull (aDoc); final PSReader aReader = new PSReader (aRes); final PSSchema aSchema = aReader.readSchemaFromXML (aDoc.getDocumentElement ()); assertNotNull (aSchema); final CollectingPSErrorHandler aErrHdl = new CollectingPSErrorHandler (); assertTrue (aRes.getPath (), aSchema.isValid (aErrHdl)); assertTrue (aErrHdl.isEmpty ()); final PSSchema aPreprocessedSchema = aPreprocessor.getAsMinimalSchema (aSchema); assertNotNull (aPreprocessedSchema); if (false) { final String sXML = MicroWriter.getNodeAsString (aPreprocessedSchema.getAsMicroElement ()); SimpleFileIO.writeFile (new File ("test-minified", FilenameHelper.getWithoutPath (aRes.getPath ()) + ".min-pure.sch"), sXML, XMLWriterSettings.DEFAULT_XML_CHARSET_OBJ); } assertTrue (aRes.getPath (), aPreprocessedSchema.isValid (aErrHdl)); assertTrue (aRes.getPath (), aPreprocessedSchema.isMinimal ()); } }