Module (@Nullable String projectId, @Nullable String moduleType) { ModuleBridge module = mock(ModuleBridge.class); Project project = mock(Project.class); when(module.getProject()).thenReturn(project); MutableEntityStorage builder = MutableEntityStorage.create(); ModuleEntity moduleEntity = builder.addEntity(ModuleEntity.create("m", Collections.emptyList(), NonPersistentEntitySource.INSTANCE, moduleBuilder -> { moduleBuilder.setExModuleOptions(ExternalSystemModuleOptionsEntity.create(NonPersistentEntitySource.INSTANCE, externalBuilder -> { externalBuilder.setExternalSystem(SYSTEM_ID.getId()); externalBuilder.setExternalSystemModuleType(moduleType); externalBuilder.setLinkedProjectId(projectId); return Unit.INSTANCE; })); return Unit.INSTANCE; })); ModuleManagerBridgeImpl.getMutableModuleMap(builder).addMapping(moduleEntity, module); when(module.getEntityStorage()).thenReturn(new VersionedEntityStorageOnSnapshot(builder.toSnapshot())); ExternalSystemModulePropertyManager modulePropertyManager = new ExternalSystemModulePropertyManagerBridge(module); when(module.getService(ExternalSystemModulePropertyManager.class)).thenReturn(modulePropertyManager); return module; }