()
| 48 | } |
| 49 | |
| 50 | @Test |
| 51 | public void testValue() { |
| 52 | // Setup search - Calculator.MAX_DEPTH = 30 |
| 53 | // - Javac inlines constants, but keeps the field constant value attribute |
| 54 | // - So there should be the field const and the inline value in results |
| 55 | SearchCollector collector = SearchBuilder.in(workspace).skipDebug() |
| 56 | .query(new ValueQuery(30)).build(); |
| 57 | // Show results |
| 58 | List<SearchResult> results = collector.getAllResults(); |
| 59 | assertEquals(2, results.size()); |
| 60 | ValueResult resField = (ValueResult) results.get(0); |
| 61 | contextEquals(resField.getContext(), "calc/Calculator", "MAX_DEPTH", "I"); |
| 62 | ValueResult resInsn = (ValueResult) results.get(1); |
| 63 | contextEquals(resInsn.getContext().getParent(), "calc/Calculator", "evaluate", "(ILjava/lang/String;)D"); |
| 64 | } |
| 65 | |
| 66 | @Test |
| 67 | public void testOverlappingResultsInMethodCode() { |
nothing calls this directly
no test coverage detected