How to use findDescriptor method of org.spekframework.intellij.domain.ScopeDescriptorCache class

Best Spek code snippet using org.spekframework.intellij.domain.ScopeDescriptorCache.findDescriptor

ScopeDescriptorCache.kt

Source:ScopeDescriptorCache.kt Github

copy

Full Screen

...13import java.util.concurrent.ConcurrentHashMap14class ScopeDescriptorCache: ProjectComponent {15 private val cache = ConcurrentHashMap<String, Pair<Long, ScopeDescriptor.Group>?>()16 private val index = ConcurrentHashMap<String, ScopeDescriptor?>()17 fun findDescriptor(path: Path): ScopeDescriptor? {18 return index.getOrDefault(path.serialize(), null)19 }20 fun fromCallExpression(callExpression: KtCallExpression): ScopeDescriptor? {21 val context = fetchSynonymContext(callExpression)22 if (context != null) {23 return PsiTreeUtil.getParentOfType(callExpression, KtClassOrObject::class.java)?.let {24 fromClassOrObject(it)?.findDescriptorForElement(callExpression)25 }26 }27 return null28 }29 fun fromClassOrObject(clz: KtClassOrObject): ScopeDescriptor.Group? {30 if (clz.isAbstract() || clz.isObjectLiteral() || !isSpekSubclass(clz)) {31 return null32 }33 val fqName = checkNotNull(clz.fqName).asString()34 var cached = cache.getOrDefault(fqName, null)35 if (cached == null || cached.first < clz.modificationStamp) {36 cached = clz.modificationStamp to buildDescriptor(clz)37 cache[fqName] = cached38 }...

Full Screen

Full Screen

SpekSMTestLocator.kt

Source:SpekSMTestLocator.kt Github

copy

Full Screen

...14 }15 val descriptorCache = checkNotNull(16 project.getComponent(ScopeDescriptorCache::class.java)17 )18 val descriptor = descriptorCache.findDescriptor(19 PathBuilder.parse(path).build()20 )21 return if (descriptor != null) {22 listOf<Location<PsiElement>>(PsiLocation(descriptor.element.navigationElement))23 } else {24 emptyList()25 }26 }27}...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Spek automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful