### Question:
WarBuilder { public URI buildWar() { if (option.getName() == null) { option.name(UUID.randomUUID().toString()); } processClassPath(); try { File webResourceDir = getWebResourceDir(); File probeWar = new File(tempDir, option.getName() + ".war"); ZipBuilder builder = new ZipBuilder(probeWar); for (String library : option.getLibraries()) { File file = toLocalFile(library); if (file.isDirectory()) { file = toJar(file); } LOG.debug("including library {} = {}", library, file); builder.addFile(file, "WEB-INF/lib/" + file.getName()); } builder.addDirectory(webResourceDir, ""); builder.close(); URI warUri = probeWar.toURI(); LOG.info("WAR probe = {}", warUri); return warUri; } catch (IOException exc) { throw new TestContainerException(exc); } } WarBuilder(File tempDir, WarProbeOption option); URI buildWar();  }### Answer:
@Test public void buildWar() throws MalformedURLException, IOException { war = localCopy(warProbe().library("target/classes")); assertThat(war.getEntry("WEB-INF/beans.xml"), is(notNullValue())); assertThat(war.getEntry("WEB-INF/lib/pax-exam-spi-" + Info.getPaxExamVersion() + ".jar"), is(notNullValue())); }
@Test public void buildWarWithName() throws MalformedURLException, IOException { WarBuilder warBuilder = new WarBuilder(DefaultExamSystem.createTempDir(), warProbe().library("target/classes").name("foo")); URI uri = warBuilder.buildWar(); assertThat(new File(uri).getName(), is("foo.war")); }