I am currently trying to repair some old tests (which I did not
even write myself) based on AbstractWicketTest and WicketTester.
At the moment all tests derived from AbstractWicketTest or using
TestNGWicketTester fail with some exception inside Wicket.

Since I am rather unfamiliar with the wicket test infrastructure,
I'd like to ask here, if the stuff below rings any bell with
anyone of you? This second class of exceptions I get seems to 
be related to the fact that in our application all CSS and 
Javascript includes are handled by a ConcatBundeResource. At
least that's the one where the test code crashes with an NPE.

Again, the test is real simple, it consists of rendering a page
and checking for exceptions etc., this is the code:

|    public void setUp() {
|        this.tester = new TestNGWicketTester( new MyApplication() );
|    }

|    public void testRender() {
|        this.tester.startPage( ResetPasswordPage.class );
|        this.tester.assertRenderedPage( ResetPasswordPage.class );
|    }

And the exception I am getting is the following:

 [testng] Caused by: java.lang.NullPointerException: null
 [testng]     at 
org.apache.wicket.resource.bundles.ConcatBundleResource.readAllResources(ConcatBundleResource.java:169)
 ~[wicket-core-6.8.0.jar:6.8.0]
 [testng]     at 
org.apache.wicket.resource.bundles.ConcatBundleResource.getCacheableResourceStream(ConcatBundleResource.java:226)
 ~[wicket-core-6.8.0.jar:6.8.0]
 [testng]     at 
org.apache.wicket.request.resource.caching.version.LastModifiedResourceVersion.getVersion(LastModifiedResourceVersion.java:41)
 ~[wicket-core-6.8.0.jar:6.8.0]
 [testng]     at 
org.apache.wicket.request.resource.caching.version.RequestCycleCachedResourceVersion.getVersion(RequestCycleCachedResourceVersion.java:97)
 ~[wicket-core-6.8.0.jar:6.8.0]
 [testng]     at 
org.apache.wicket.request.resource.caching.FilenameWithVersionResourceCachingStrategy.decorateUrl(FilenameWithVersionResourceCachingStrategy.java:97)
 ~[wicket-core-6.8.0.jar:6.8.0]
 [testng]     at 
org.apache.wicket.core.request.mapper.ResourceMapper.addCachingDecoration(ResourceMapper.java:228)
 ~[wicket-core-6.8.0.jar:6.8.0]
 [testng]     at 
org.apache.wicket.core.request.mapper.ResourceMapper.mapHandler(ResourceMapper.java:199)
 ~[wicket-core-6.8.0.jar:6.8.0]
 [testng]     at 
org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:215)
 ~[wicket-request-6.8.0.jar:6.8.0]
 [testng]     at 
org.apache.wicket.util.tester.BaseWicketTester$TestRequestMapper.mapHandler(BaseWicketTester.java:2742)
 ~[wicket-core-6.8.0.jar:6.8.0]
 [testng]     at 
org.apache.wicket.request.cycle.RequestCycle.mapUrlFor(RequestCycle.java:429) 
[wicket-core-6.8.0.jar:6.8.0]
 [testng]     at 
org.apache.wicket.request.cycle.RequestCycle.urlFor(RequestCycle.java:529) 
[wicket-core-6.8.0.jar:6.8.0]

The 'offending' code in ConcatResourceBunde looks like this: 

|        private byte[] readAllResources(List<IResourceStream> resources) 
throws IOException,
|                ResourceStreamNotFoundException
|        {
|                ByteArrayOutputStream output = new ByteArrayOutputStream();
|                for (IResourceStream curStream : resources)                  
// This is line 169, where the NPE occurs!
|                        IOUtils.copy(curStream.getInputStream(), output);
|
|                byte[] bytes = output.toByteArray();
|
|                if (getCompressor() != null)
|                {
|                        String nonCompressed = new String(bytes, "UTF-8");
|                        bytes = 
getCompressor().compress(nonCompressed).getBytes("UTF-8");
|                }
|
|                return bytes;
|        }


Cheers,

M'bert

-- 
----------- / http://herbert.the-little-red-haired-girl.org / -------------
=+= 
manche meinen, lechts und rinks kann man nicht velwechsern.
werch ein illtum!  -- elnst jandr

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to