This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
JUnit test ant script (nbbuild/templates/common.xml) sets the ordering of runtime class path wrongly. Compiled junit test classes must be the first one in the classpath list, but right now, its in the middle. So, if any user wanting to have a "Mock setup" of test classes to override implementation during test scenario, mocked classes do not get picked. This is a different behavior from XTest, which does the right thing. I had checked in the fix for this, but was told to back out and file a bug. "I would suggest to revert this unreviewed change and file your patch as a P2 issue against nbbuild, mention that the issue blocks 5.5 and add the 5.5_candidate status whiteboard. - Andrei" The fix was in http://nbbuild.netbeans.org/source/browse/nbbuild/templates/common.xml?r1=1.13.2.4.2.1&r2=1.13.2.4.2.2
I agree that the behavior ought to be changed, if only for compatibility for XTest. Also the CP order inside the IDE (ClassPathProvider) would need to be reordered to match. I would however rather not have such a change be in 5.5 because it is not in apisupport 5.0u1 so we would either have to have the 5.0u1 harness != 5.5 harness (unacceptable) or put the patch in 5.0u1 (possible but very late to be making such a change). Why I do not consider this a priority, and suggest you do without it for 5.5: it is generally undesirable to make mock impls of classes by physically replacing the class anyway. You are then running a different version of the class from what is actually in the module; you risk having a different signature; code coverage tools, debuggers, and profilers will get confused; etc. Generally such usages should be rewritten by either including minimal test hooks in the real class; or using Lookup or a static package-private setter to inject an alternate impl of pieces of logic which need to be mocked; or just making a more flexible code architecture which splits functionality along interface lines and makes pieces replaceable in general. There are various examples of doing exactly this in existing unit tests in nb.org, which is why we did not ever need to use a particular classpath order for running unit tests. I can provide pointers to some examples if you need them.
BTW 1.13.2.4.2.3 was not an exact reversion of 1.13.2.4.2.2 (check CVS manual re. how to use up -j -j), rather it changed formatting of whitespace, so fixing to be identical to 1.13.2.4.2.1: Checking in common.xml; /shared/data/ccvs/repository/nbbuild/templates/common.xml,v <-- common.xml new revision: 1.13.2.4.2.4; previous revision: 1.13.2.4.2.3 done
Jesse, I heard talks that 50u1 harness has to be part of 5.5 harness... It is serious problem for developer who already has written tests:(. Yes it is late. But I am not against to integrate to 50u1.
Not into 7.0 or next release. Feel free to reopen if more important than it seems.
NetBeans.org Migration: changing resolution from LATER to WONTFIX
Was still valid. Fixing: core-main #a573b72385dd
Integrated into 'main-golden', will be available in build *200911241400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/a573b72385dd User: Jesse Glick <jglick@netbeans.org> Log: #74167: build/test/unit/classes should come at front of ${test.unit.run.cp} to permit tests to override classes from the main module.