[jboss-dev-forums] [Design the new POJO MicroContainer] - VFSStructureBuilderUnitTestCase todo

alesj do-not-reply at jboss.com
Wed Mar 12 09:38:14 EDT 2008


How do you test if the classpath is correct?

I currently get 1 ClassPathEntry with "" path, but VFSDeploymentContext::getClassPath returns null.
Is this legit?

This is how I currently do it:

  |    protected void checkClassPath(VFSDeploymentContext context, ContextInfo contextInfo) throws Exception
  |    {
  |       List<ClassPathEntry> classPathEntries = contextInfo.getClassPath();
  |       List<VirtualFile> classPath = context.getClassPath();
  |       
  |       if (classPathEntries == null)
  |          assertNull(classPath);
  |       else
  |       {
  |          int cpeSize = classPathEntries.size();
  |          int cpSize = classPath != null ? classPath.size() : 0;
  |          assertTrue(cpeSize >= cpSize);
  |          for(int i = 0; i < cpeSize; i++)
  |          {
  |             ClassPathEntry entry = classPathEntries.get(i);
  |             VirtualFile file = (i < cpSize) ? classPath.get(i) : null;
  |             String path = entry.getPath();
  |             if ("".equals(path))
  |                assertTrue(file == null || "".equals(file.getPathName()));
  |             else
  |             {
  |                assertNotNull(file);
  |                assertEquals(path, file.getPathName());
  |             }
  |          }
  |       }
  |    }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4135937#4135937

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135937



More information about the jboss-dev-forums mailing list