I have a NodesTestCase where I try to resolve a module. This has worked before via:
return (solution) module-reference/my.module.namespace/.resolve(MPSModuleRepository.getInstance());
The module I want to load is in the same project as the module that contains the test case. When I run above code from within MPS, it still works.
When I run it from my console, it cannot resolve the module reference anymore (the resolve method returns null).
I tried different other ways to resolve the module-reference. For example, via `project.getModules()` or `project.getProjectModules()`, both returning empty lists when I run the test from console, but both work fine when run from within MPS.
I also tried `project.getRepositry().getModules()`: When run from within MPS, this returns a boatload of modules (903). When run from console, it is still 548 modules. However, the one I am looking for is not part of the result when run from console.
In other words, when I call `project.getRepositry().getModule(module-reference/my.module.namespace/.getModuleId())` I get the desired result only when I run it from within MPS, not from console.
Notive that this "magic" `project` variable is different when run from console. From within MPS, I have two instances of MPS open: (1) my language engineering project, and (2) a second project with sandbox-solutions and the test solution from where I want to load one of the sandbox-solution modules. So, when I print `System.out.println("Project.name: " + project.getProjectFile().getAbsolutePath());` from MPS, project points to my "engineering workspace" (not what I would expect!), whilst it points to my "sandbox workspace" when run from console.
Can somebody shed some light for me on this behavior? How can I resolve a module-reference correctly from within a NodesTestCase?