mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-08-28 05:25:25 +00:00
feat(SM-9): add Java integration test with class Child extends Parent fixture
Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/cc58249b-42f1-45a9-89fb-e3917e4d0171 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
This commit is contained in:
parent
c7e701f2fe
commit
37563a3152
5 changed files with 55 additions and 1 deletions
1
gitnexus/package-lock.json
generated
1
gitnexus/package-lock.json
generated
|
|
@ -17,7 +17,6 @@
|
|||
"commander": "^12.0.0",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.19.2",
|
||||
"gitnexus-shared": "file:../gitnexus-shared",
|
||||
"glob": "^11.0.0",
|
||||
"graphology": "^0.25.4",
|
||||
"graphology-indices": "^0.17.0",
|
||||
|
|
|
|||
5
gitnexus/test/fixtures/lang-resolution/java-child-extends-parent/src/models/Child.java
vendored
Normal file
5
gitnexus/test/fixtures/lang-resolution/java-child-extends-parent/src/models/Child.java
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
package models;
|
||||
|
||||
public class Child extends Parent {
|
||||
public void childOnly() {}
|
||||
}
|
||||
5
gitnexus/test/fixtures/lang-resolution/java-child-extends-parent/src/models/Parent.java
vendored
Normal file
5
gitnexus/test/fixtures/lang-resolution/java-child-extends-parent/src/models/Parent.java
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
package models;
|
||||
|
||||
public class Parent {
|
||||
public String parentMethod() { return "hello"; }
|
||||
}
|
||||
10
gitnexus/test/fixtures/lang-resolution/java-child-extends-parent/src/services/App.java
vendored
Normal file
10
gitnexus/test/fixtures/lang-resolution/java-child-extends-parent/src/services/App.java
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package services;
|
||||
|
||||
import models.Child;
|
||||
|
||||
public class App {
|
||||
public void run() {
|
||||
Child c = new Child();
|
||||
c.parentMethod();
|
||||
}
|
||||
}
|
||||
|
|
@ -2098,3 +2098,38 @@ describe('Cross-class method chain resolution (Java) — #575', () => {
|
|||
expect(cityAccess.length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SM-9: lookupMethodByOwnerWithMRO — class Child extends Parent
|
||||
// child.parentMethod() resolves to Parent#parentMethod via MRO parent walk.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe('Java Child extends Parent — inherited method resolution (SM-9)', () => {
|
||||
let result: PipelineResult;
|
||||
|
||||
beforeAll(async () => {
|
||||
result = await runPipelineFromRepo(
|
||||
path.join(FIXTURES, 'java-child-extends-parent'),
|
||||
() => {},
|
||||
);
|
||||
}, 60000);
|
||||
|
||||
it('detects Parent and Child classes', () => {
|
||||
const classes = getNodesByLabel(result, 'Class');
|
||||
expect(classes).toContain('Parent');
|
||||
expect(classes).toContain('Child');
|
||||
});
|
||||
|
||||
it('emits EXTENDS edge: Child → Parent', () => {
|
||||
const extends_ = getRelationships(result, 'EXTENDS');
|
||||
expect(edgeSet(extends_)).toContain('Child → Parent');
|
||||
});
|
||||
|
||||
it('resolves c.parentMethod() to Parent#parentMethod via MRO walk', () => {
|
||||
const calls = getRelationships(result, 'CALLS');
|
||||
const parentMethodCall = calls.find(
|
||||
(c) => c.target === 'parentMethod' && c.targetFilePath.includes('Parent'),
|
||||
);
|
||||
expect(parentMethodCall).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue