ko/archetype-test/src/test/java/org/apidesign/bck2brwsr/ko/archetype/test/VerifyArchetypeTest.java
branchcanvas
changeset 1297 2960a1d37277
parent 1273 37ad459579bc
child 1347 9cc0e1034f92
     1.1 --- a/ko/archetype-test/src/test/java/org/apidesign/bck2brwsr/ko/archetype/test/VerifyArchetypeTest.java	Mon Sep 09 17:34:30 2013 +0200
     1.2 +++ b/ko/archetype-test/src/test/java/org/apidesign/bck2brwsr/ko/archetype/test/VerifyArchetypeTest.java	Mon Sep 23 07:52:41 2013 -0700
     1.3 @@ -18,11 +18,15 @@
     1.4  package org.apidesign.bck2brwsr.ko.archetype.test;
     1.5  
     1.6  import java.io.File;
     1.7 +import java.io.IOException;
     1.8 +import java.io.InputStream;
     1.9  import java.util.Properties;
    1.10 +import java.util.zip.ZipEntry;
    1.11  import java.util.zip.ZipFile;
    1.12  import org.apache.maven.it.Verifier;
    1.13  import org.testng.annotations.Test;
    1.14  import static org.testng.Assert.*;
    1.15 +import org.testng.reporters.Files;
    1.16  
    1.17  /**
    1.18   *
    1.19 @@ -87,8 +91,18 @@
    1.20          assertTrue(zip.isFile(), "Zip file with website was created");
    1.21          
    1.22          ZipFile zf = new ZipFile(zip);
    1.23 -        assertNotNull(zf.getEntry("public_html/index.html"), "index.html found");
    1.24 +        final ZipEntry index = zf.getEntry("public_html/index.html");
    1.25 +        assertNotNull(index, "index.html found");
    1.26          
    1.27 +        String txt = readText(zf.getInputStream(index));
    1.28 +        final int beg = txt.indexOf("${");
    1.29 +        if (beg >= 0) {
    1.30 +            int end = txt.indexOf("}", beg);
    1.31 +            if (end < beg) {
    1.32 +                end = txt.length();
    1.33 +            }
    1.34 +            fail("No substitutions in index.html. Found: " + txt.substring(beg, end));
    1.35 +        }
    1.36      }
    1.37  
    1.38      private Verifier generateFromArchetype(final File dir, String... params) throws Exception {
    1.39 @@ -112,4 +126,8 @@
    1.40          v.verifyErrorFreeLog();
    1.41          return v;
    1.42      }
    1.43 +    
    1.44 +    private static String readText(InputStream is) throws IOException {
    1.45 +        return Files.readFile(is);
    1.46 +    }
    1.47  }