MCPcopy
hub / github.com/Col-E/Recaf / testMemberReference

Method testMemberReference

src/test/java/me/coley/recaf/SearchTest.java:196–211  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

194 }
195
196 @Test
197 public void testMemberReference() {
198 // Setup search - References to the "Calculator.log(int, String)" method
199 SearchCollector collector = SearchBuilder.in(workspace).skipDebug()
200 .query(new MemberReferenceQuery("calc/Calculator", "log", null, EQUALS)).build();
201 // Show results
202 List<SearchResult> results = collector.getAllResults();
203 assertEquals(2, results.size());
204 for (SearchResult res : results) {
205 Context.InsnContext insnContext = (Context.InsnContext) res.getContext();
206 String owner = insnContext.getParent().getParent().getName();
207 if (!owner.equals("calc/Calculator")) {
208 fail("Unexpected result in: " + owner);
209 }
210 }
211 }
212
213 @Test
214 public void testNoMemberReferenceWhenCodeSkipped() {

Callers

nothing calls this directly

Calls 10

inMethod · 0.95
getAllResultsMethod · 0.95
queryMethod · 0.80
skipDebugMethod · 0.80
buildMethod · 0.65
getNameMethod · 0.65
sizeMethod · 0.45
getContextMethod · 0.45
getParentMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected