Best Spek code snippet using org.spekframework.intellij.domain.ScopeDescriptorCache.findDescriptor
ScopeDescriptorCache.kt
Source:ScopeDescriptorCache.kt
...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 }...
SpekSMTestLocator.kt
Source:SpekSMTestLocator.kt
...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}...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!