Source:
public UILocalSession openSessionFromFile(final UIResource uiLocalSessionResource, final boolean useMoreThanOneSemanticFiles) { final OpenedSessionListener openedSessionListener = new OpenedSessionListener(); SessionManager.INSTANCE.addSessionsListener(openedSessionListener); ICondition addedToSessionManager = new OpenedSessionCondition(SessionManager.INSTANCE.getSessions().size() + 1); uiLocalSessionResource.openSession(); SWTBotUtils.waitProgressMonitorClose(OpenRepresentationsFileJob.JOB_LABEL, OpenRepresentationsFileJob.JOB_LABEL, SWTBotUtils.CLOSE_PROGRESS_MONITOR_TIMEOUT, TimeUnit.SECONDS, false); try { Job.getJobManager().join(AbstractRepresentationsFileJob.FAMILY, new NullProgressMonitor()); } catch (OperationCanceledException | InterruptedException e) { fail("The session was not correctly openned: " + e.getMessage()); } bot.waitUntil(addedToSessionManager); bot.waitUntil(openedSessionListener); SessionManager.INSTANCE.removeSessionsListener(openedSessionListener); Session openedSession = openedSessionListener.getOpenedSession(); if (openedSession == null) { Assert.assertTrue("No session is opened!", SessionManager.INSTANCE.getSessions().size() > 0); } final Collection<Resource> semanticResources = openedSession.getSemanticResources(); if (useMoreThanOneSemanticFiles) { MatcherAssert.assertThat("Semantic resource not found", semanticResources.size(), Matchers.not(Matchers.is(0))); } else { if (semanticResources.size() > 1) { StringBuffer names = new StringBuffer(); for (Resource resource : semanticResources) { names.append(resource.getURI().toPlatformString(true)); names.append(", "); } names.delete(names.length() - 2, names.length()); Assert.fail("Too many semantic resources, only one semantic resource is expected. List of semantic resources: " + names); } } Resource semanticResource = semanticResources.iterator().next(); return new UILocalSession(UIResource.createFromResource(semanticResource), uiLocalSessionResource, openedSession); }

Target:
public UILocalSession openSessionFromFile(final UIResource uiLocalSessionResource, final boolean useMoreThanOneSemanticFiles) { final OpenedSessionListener openedSessionListener = new OpenedSessionListener(); SessionManager.INSTANCE.addSessionsListener(openedSessionListener); ICondition addedToSessionManager = new OpenedSessionCondition(SessionManager.INSTANCE.getSessions().size() + 1); uiLocalSessionResource.openSession(); SWTBotUtils.waitProgressMonitorClose(OpenRepresentationsFileJob.JOB_LABEL, OpenRepresentationsFileJob.JOB_LABEL, SWTBotUtils.CLOSE_PROGRESS_MONITOR_TIMEOUT, TimeUnit.SECONDS, false); try { Job.getJobManager().join(AbstractRepresentationsFileJob.FAMILY, new NullProgressMonitor()); } catch (OperationCanceledException | InterruptedException e) { fail("The session was not correctly opened: " + e.getMessage()); } bot.waitUntil(addedToSessionManager); bot.waitUntil(openedSessionListener); SessionManager.INSTANCE.removeSessionsListener(openedSessionListener); Session openedSession = openedSessionListener.getOpenedSession(); if (openedSession == null) { Assert.assertTrue("No session is opened!", SessionManager.INSTANCE.getSessions().size() > 0); } final Collection<Resource> semanticResources = openedSession.getSemanticResources(); if (useMoreThanOneSemanticFiles) { MatcherAssert.assertThat("Semantic resource not found", semanticResources.size(), Matchers.not(Matchers.is(0))); } else { if (semanticResources.size() > 1) { StringBuffer names = new StringBuffer(); for (Resource resource : semanticResources) { names.append(resource.getURI().toPlatformString(true)); names.append(", "); } names.delete(names.length() - 2, names.length()); Assert.fail("Too many semantic resources, only one semantic resource is expected. List of semantic resources: " + names); } } Resource semanticResource = semanticResources.iterator().next(); return new UILocalSession(UIResource.createFromResource(semanticResource), uiLocalSessionResource, openedSession); }