<commit_before>// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.lang.resolve

import groovy.transform.CompileStatic
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrClassDefinition
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrAccessorMethod
import org.jetbrains.plugins.groovy.lang.resolve.api.GroovyMapProperty
import org.jetbrains.plugins.groovy.util.GroovyLatestTest
import org.jetbrains.plugins.groovy.util.ReferenceExpressionTest
import org.junit.Before
import org.junit.Test

import static com.intellij.psi.CommonClassNames.JAVA_LANG_INTEGER

@CompileStatic
class CustomMapPropertyTest extends GroovyLatestTest implements ReferenceExpressionTest {

  @Before
  void addClasses() {
    fixture.addFileToProject 'classes.groovy', '''\
class Pojo { def pojoProperty }

class SomeMapClass extends HashMap<String, Pojo> {
    public static final CONSTANT = 1
    static class Inner {
        public static final INNER_CONSTANT = 4
    }
}
'''
  }

  @Test
  void 'constant in instance context'() {
    referenceExpressionTest 'new SomeMapClass().<caret>CONSTANT', GroovyMapProperty, 'Pojo'
  }

  @Test
  void 'constant in static context'() {
    referenceExpressionTest 'SomeMapClass.<caret>CONSTANT', GrField, JAVA_LANG_INTEGER
  }

  @Test
  void 'inner class in instance context'() {
    referenceExpressionTest 'new SomeMapClass().<caret>Inner', GroovyMapProperty, 'Pojo'
  }

  @Test
  void 'inner class in static context'() {
    referenceExpressionTest 'SomeMapClass.<caret>Inner', GrClassDefinition, 'java.lang.Class<SomeMapClass.Inner>'
  }

  @Test<commit_msg>[groovy] remove unnecessary carets from testdata<commit_after>// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.lang.resolve

import groovy.transform.CompileStatic
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrClassDefinition
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrAccessorMethod
import org.jetbrains.plugins.groovy.lang.resolve.api.GroovyMapProperty
import org.jetbrains.plugins.groovy.util.GroovyLatestTest
import org.jetbrains.plugins.groovy.util.ReferenceExpressionTest
import org.junit.Before
import org.junit.Test

import static com.intellij.psi.CommonClassNames.JAVA_LANG_INTEGER

@CompileStatic
class CustomMapPropertyTest extends GroovyLatestTest implements ReferenceExpressionTest {

  @Before
  void addClasses() {
    fixture.addFileToProject 'classes.groovy', '''\
class Pojo { def pojoProperty }

class SomeMapClass extends HashMap<String, Pojo> {
    public static final CONSTANT = 1
    static class Inner {
        public static final INNER_CONSTANT = 4
    }
}
'''
  }

  @Test
  void 'constant in instance context'() {
    referenceExpressionTest 'new SomeMapClass().CONSTANT', GroovyMapProperty, 'Pojo'
  }

  @Test
  void 'constant in static context'() {
    referenceExpressionTest 'SomeMapClass.CONSTANT', GrField, JAVA_LANG_INTEGER
  }

  @Test
  void 'inner class in instance context'() {
    referenceExpressionTest 'new SomeMapClass().Inner', GroovyMapProperty, 'Pojo'
  }

  @Test
  void 'inner class in static context'() {
    referenceExpressionTest 'SomeMapClass.Inner', GrClassDefinition, 'java.lang.Class<SomeMapClass.Inner>'
  }

  @Test
{'fraction_non_alphanumeric': 0.09252669039145907, 'fraction_numerical': 0.006569942513003011, 'mean_word_length': 4.912621359223301, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2566460', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1077, 'n_words': 258}