URI testsResourceUri = URI.createPlatformResourceURI(resource.getFullPath() + "." + JexResource.JEX_EXTENSION, true);
IJavaElement javaElement = JdtHelper.findIJavaElement(javaProject, segments, 1);
if (javaElement != null) {
JdtTestAnnotationsToModelConverter testAnnotationsToModelConverter = new JdtTestAnnotationsToModelConverter(JexFactory.eINSTANCE.createExercise(), javaElement);
if (testAnnotationsToModelConverter.canConvert()) {
Exercise exercise = testAnnotationsToModelConverter.convert();
Resource jexResource = resourceSet.createResource(testsResourceUri);
jexResource.getContents().add(exercise);
return true;
}
}