Jeanne Boyarsky wrote:Raj,
How does the code get used in Java code? From your example, it looks like unused code which probably isn't the intent.
Junilu Lacar wrote:Since it is a field declaration, it's not something that any test code can execute directly. So even if you could write a test that asserts something about the array, I doubt it would be reported as being "covered" by a test. The fact that it is a static field declaration guarantees that it wil be executed when that class is loaded.
Are you trying to get 100% coverage? Don't. It's not worth the effort. You worrying about having test coverage for that line of code has already been a waste of time.
public class MyClass {
.
.
.
.
private static final String SELECT = "SELECT ack_num, testform_detl_id, uniqueno, assment_year, ver_name FROM test_form_detl";
private static final int[] SELECT_IDX = { 32, 34, 35, 36, 37 };
.
.
.
.
.
}
i know that super keyword is used to call overridden method version of superclass but as universal truth we can't override static method then why it is working here, what is the wrong with java ?
String objects which cannot be referenced once the 'for loop' executes are very likely garbage collected, which is why the profiler is unable to show them.