sk.baka.webvm.analyzer.classloader
Class AbstractResourceLinkTest

java.lang.Object
  extended by sk.baka.webvm.analyzer.classloader.AbstractResourceLinkTest
Direct Known Subclasses:
DirResourceLinkTest, JarResourceLinkTest

public abstract class AbstractResourceLinkTest
extends Object

Tests the ResourceLink class.

Author:
Martin Vysny

Field Summary
protected  File file
          The jar file or directory to test on.
 
Constructor Summary
AbstractResourceLinkTest()
           
 
Method Summary
static void assertDistinctItems(Collection<?> c)
          Asserts that given collection does not contain equal items.
static void assertEqualsLinks(String[] expected, List<ResourceLink> got)
          Checks that given resource list contains required elements.
static void assertEqualsSet(Collection<?> expectedSet, Collection<?> gotSet)
          Checks that given resource list contains required elements.
protected abstract  File getFile()
          Returns the file to test on.
protected  ResourceLink getSun()
          Returns link denoting the "com.sun" package.
 void setUp()
           
 void testContentsWalking()
          Tests package content walking.
 void testName()
          Tests the ResourceLink.getName() method.
 void testRoot()
           
 void testRootContents()
          Tests contents of the root package.
 void testRootContentsGrouping()
          Tests package name grouping.
 void testRootFullName()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

protected File file
The jar file or directory to test on.

Constructor Detail

AbstractResourceLinkTest

public AbstractResourceLinkTest()
Method Detail

getFile

protected abstract File getFile()
Returns the file to test on.

Returns:
the file.

setUp

public void setUp()
           throws Exception
Throws:
Exception

testRoot

public void testRoot()
              throws IOException
Throws:
IOException - if i/o error occurs.

testName

public void testName()
              throws IOException
Tests the ResourceLink.getName() method.

Throws:
IOException

testRootFullName

public void testRootFullName()
                      throws IOException
Throws:
IOException - if i/o error occurs.

testRootContents

public void testRootContents()
                      throws IOException
Tests contents of the root package.

Throws:
IOException - if i/o error occurs.

testContentsWalking

public void testContentsWalking()
                         throws IOException
Tests package content walking.

Throws:
IOException - if i/o error occurs.

getSun

protected final ResourceLink getSun()
                             throws IOException
Returns link denoting the "com.sun" package.

Returns:
the link to the "com.sun" package.
Throws:
IOException - if i/o error occurs.

testRootContentsGrouping

public void testRootContentsGrouping()
                              throws IOException
Tests package name grouping.

Throws:
IOException - if i/o error occurs.

assertDistinctItems

public static void assertDistinctItems(Collection<?> c)
Asserts that given collection does not contain equal items.

Parameters:
c - the collection to check, not null

assertEqualsLinks

public static void assertEqualsLinks(String[] expected,
                                     List<ResourceLink> got)
Checks that given resource list contains required elements.

Parameters:
expected - the expected resource names.
got - actual resource list. Must contain unique items.

assertEqualsSet

public static void assertEqualsSet(Collection<?> expectedSet,
                                   Collection<?> gotSet)
Checks that given resource list contains required elements.

Parameters:
expectedSet - the expected resource names.
gotSet - actual resource list


Copyright © 2010 Baka. All Rights Reserved.