File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes junit and requirements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "junit and requirements" Watch "junit and requirements" New topic
Author

junit and requirements

Lara McCarver
Ranch Hand

Joined: Dec 09, 2003
Posts: 118
My exam has the following line:

The final program must have no dependencies on any libraries other than those of the Java 2 Platform.


Does this mean that I can't turn in a project which includes junit modules for testing? Of course it is possible to put all my junit tests in separate packages and then not include those packages in the code that I give to Sun. Though normally people recommend that you keep the tests with the classes. So your data package includes:

Data.java
DataTest.java
LockManager.java
LockManagerTest.java
RecordLock.java
RecordLockTest.java
HomemadeDB.java
HomemadeDBTest.java
etc.

By the way, Reza ( Hi ) I have figured out how to use junit for some of the multi-threaded testing I am going to do. You have your junit test method create a monitoring thread which can receive notification of important events, then you create and start the threads you need for your test. Each thread does its thing while notifying the monitor of its events. The monitor thread waits for the other threads to complete all of their expected events, then evaluates whether everything happened correctly, and finally notifies the test method that its done. The test method which created all these threads waits for notification of completion from the monitor thread.

So far, I only have 1 small test, mostly as proof of concept. I create 2 threads. Each thread does a lock() on record 2, goes to sleep for 1 second and then does an unlock() on record 2.
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
Does this mean that I can't turn in a project which includes junit modules for testing?

That would be risky. The assessor may want to compile your code, and he/she may not have junit.jar. Even if you include it with your submission, I think it would be unreasonable to expect him/her to put it in the classpath. Keep the tests for yourself, give 'em what they want.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: junit and requirements
 
Similar Threads
eclipse: JUnit Test Suite wizard problem
Locking - Notification issues
Recommended Approach For Testing Threads
Test Your Effective Locking Mechanism by Threads
How to dispute failure?