com.mchange.util.AssertException Java Examples

The following examples show how to use com.mchange.util.AssertException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RandomCSVReaderTest.java    From jmeter-bzm-plugins with Apache License 2.0 6 votes vote down vote up
private void assertRecord(String[] record) {
    switch (record[0]) {
        case "Hänsel" :
            assertEquals("Mustermann", record[1]);
            assertEquals("Einbahnstraße", record[2]);
            assertEquals("Hamburg", record[3]);
            break;
        case "André" :
            assertEquals("Lecompte", record[1]);
            assertEquals("Rue du marché", record[2]);
            assertEquals("Moÿ-de-l'Aisne", record[3]);
            break;
        case "Ἀλέξανδρος" :
            assertEquals("Павлов", record[1]);
            assertEquals("Большая Пироговская улица", record[2]);
            assertEquals("Москва́", record[3]);
            break;
        case "בנימין" : // idea shows incorrect this line. firstname is real Benjamin -> 'בנימין'
            assertEquals("يعقوب", record[1]);
            assertEquals("Street", record[2]);
            assertEquals("Megapolis", record[3]);
            break;
        default:
            throw new AssertException("No such firstname in csv file " + record[0]);
    }
}
 
Example #2
Source File: NdkSipExportTest.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void exportPeriodical() throws Exception {
    NdkExport export = new NdkSipExport(remoteStorage, appConfig);
    String pid = "uuid:8548cc82-3601-45a6-8eb0-df6538db4de6";

    List<NdkExport.Result> resultsList = export.export(folder.getRoot(), Collections.singletonList(pid),
            true, true, null, null);

    resultsList.stream().filter(result -> result.getValidationError() != null).flatMap(result -> result.getValidationError().getExceptions().stream())
            .forEach(exception -> collector.addError(exception.getEx() != null ? exception.getEx() : new AssertException(exception.getMessage())));

    String sipIdentifier = "123";
    Path sip = resultsList.get(0).getTargetFolder().toPath().resolve(sipIdentifier);
    Files.walkFileTree(sip, new SimpleFileVisitor<Path>() {
        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
            System.out.println(file);
            return FileVisitResult.CONTINUE;
        }
    });

    validatePackage(sip, 4);

}
 
Example #3
Source File: NdkSipExportTest.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Test export of multipart monograph, 1 eVolume, 2 eChapter
 */
@Test
public void exportMultipartMonograph() throws Exception {
    NdkExport export = new NdkSipExport(remoteStorage, appConfig);
    String pid = "uuid:26342028-12c8-4446-9217-d3c9f249bd13";

    List<NdkExport.Result> resultsList = export.export(folder.getRoot(), Collections.singletonList(pid),
            true, true, null, null);

    resultsList.stream().filter(result -> result.getValidationError() != null).flatMap(result -> result.getValidationError().getExceptions().stream())
            .forEach(exception -> collector.addError(exception.getEx() != null ? exception.getEx() : new AssertException(exception.getMessage())));

    String packageId = "123";
    Path sip = folder.getRoot().toPath().resolve(StringUtils.removeStart(pid, "uuid:")).resolve(packageId);

    Files.walkFileTree(sip, new SimpleFileVisitor<Path>() {
        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
            System.out.println(file);
            return FileVisitResult.CONTINUE;
        }
    });

    validatePackage(sip, 4);
}