Search the web
Sign In
New User? Sign Up
jdepend
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Running package Dependency tests through JUnit   Message List  
Reply | Forward Message #11 of 72 |
Hi,

I am trying to run automated JUnit tests from ant to check package
dependencies. The tests I am trying to right are very similar to
the 'Dependency Constraint' test in the documentation. My test case
contains the following two tests,

public void testDependencyConstraint1()
{
//Step 1. Create new DependencyConstraint
DependencyConstraint constraint = new DependencyConstraint();

//Step 2. Add packages to the DependencyConstraint
JavaPackage CmaUtil = constraint.addPackage("bridges.cma.util");
JavaPackage CmaView = constraint.addPackage
("bridges.cma.view");

//Step 3. Set package Dependencies
CmaView.dependsUpon( CmaUtil );

//Step 4. Analyze
m_jdepend.analyze();

//Step 5. Perform assertions
// This should be true because bridges.cma.view package does
// use the bridges.cma.util package.
assertEquals( "Dependency mismatch", true,
m_jdepend.dependencyMatch( constraint ) );
}

public void testDependencyConstraint2()
{
//Step 1. Create new DependencyConstraint
DependencyConstraint constraint = new DependencyConstraint();

//Step 2. Add packages to the DependencyConstraint
JavaPackage CmaUtil = constraint.addPackage( "bridges.cma.util" );
JavaPackage CmaView = constraint.addPackage
("bridges.cma.view");

//Step 3. Set package Dependencies
CmaUtil.dependsUpon( CmaView );

//Step 4. Analyze
m_jdepend.analyze();

//Step 5. Perform assertions
// This should be false because bridges.cma.util package does
// not use the bridges.cma.view package.
assertEquals( "Dependency mismatch",false,
m_jdepend.dependencyMatch( constraint ) );
}

I initialise the m_jdepend in the setUp() method to parse my source
code,
m_jdepend.addDirectory( "./build/src/java" );

Both tests should pass because bridges.cma.view package uses the
bridges.cma.util package but the reverse is not true. In both cases
the the dependencyMatch returns false when it should only return
false for testDependencyConstraint2().

I have double checked the packages that are parsed after the analyze
() method( I iterated through the collection of packages and dumped
the package names) and the packages in my constraint are being
analyzed. Have I missed something or is this a bug? The example
looked fairly simple and I believe this should work

Thank You

Cody





Mon Feb 3, 2003 10:57 pm

kheleb42
Offline Offline
Send Email Send Email

Forward
Message #11 of 72 |
Expand Messages Author Sort by Date

Hi, I am trying to run automated JUnit tests from ant to check package dependencies. The tests I am trying to right are very similar to the 'Dependency...
kheleb42 <kheleb42@...>
kheleb42
Offline Send Email
Feb 3, 2003
10:57 pm

Hi Cody, ... I'll admit that I'm not happy with the way the DependencyConstraint class turned out, but I'm not sure this is a bug. The...
Mike Clark
clarkware
Offline Send Email
Feb 4, 2003
12:17 am

... Hi Mike, Thank you for the quick response. Now I see where I was going wrong. I had another look and there are other packages that are being analyzed that...
kheleb42 <kheleb42@...>
kheleb42
Offline Send Email
Feb 4, 2003
3:31 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help