Basic Question re JUnit Tests and Deprecated Methods

R

Rhino

Very basic question: if a method becomes deprecated over time, are its unit
tests retained in the Test classes on the off chance that they may become
relevant again? Do they get commented out or are they left to run?

Am I safe in assuming that once the method is actually removed from the
class, the test cases are deleted as well?

As Java gets more mature, it's not unusual to see deprecated methods from
time to time. Have any methods in the Java API actually been deleted or are
they all just kept around in a deprecated state? What about Java classes
outside of the Java API? Just curious....
 
M

Mike Schilling

Rhino said:
Very basic question: if a method becomes deprecated over time, are
its unit tests retained in the Test classes on the off chance that
they may become relevant again? Do they get commented out or are they
left to run?

Since a method's being deprecated doesn't mean that no one calls it , it
still need to be tested.
 
A

Arne Vajhøj

Very basic question: if a method becomes deprecated over time, are its unit
tests retained in the Test classes on the off chance that they may become
relevant again? Do they get commented out or are they left to run?

Continue to test.
Am I safe in assuming that once the method is actually removed from the
class, the test cases are deleted as well?

Yes. Because the test case would neither run nor compile.
As Java gets more mature, it's not unusual to see deprecated methods from
time to time. Have any methods in the Java API actually been deleted or are
they all just kept around in a deprecated state?

I am not aware of any.
What about Java classes
outside of the Java API?

Some open source projects has made incompatible upgrades.

Arne
 
T

Tom Anderson

Very basic question: if a method becomes deprecated over time, are its
unit tests retained in the Test classes on the off chance that they may
become relevant again?
Yes.

Do they get commented out or are they left to run?

Left to run.
Am I safe in assuming that once the method is actually removed from the
class, the test cases are deleted as well?
Yes.

As Java gets more mature, it's not unusual to see deprecated methods
from time to time. Have any methods in the Java API actually been
deleted or are they all just kept around in a deprecated state?

I can't think of any that have been removed.
What about Java classes outside of the Java API? Just curious....

To take one example, HtmlUnit has made numerous backward-incompatible API
changes, removing methods, renaming them, moving them, etc. Their process
(IIRC) is to deprecate in one release, then remove in the next.

tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top