2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com
.intellij
.execution
.junit2
.info
;
19 import com
.intellij
.execution
.Location
;
20 import com
.intellij
.execution
.junit2
.segments
.ObjectReader
;
21 import com
.intellij
.openapi
.project
.Project
;
22 import com
.intellij
.psi
.*;
23 import com
.intellij
.psi
.util
.MethodSignatureUtil
;
24 import org
.jetbrains
.annotations
.Nullable
;
26 class TestCaseInfo
extends ClassBasedInfo
{
27 private String myMethod
;
29 public TestCaseInfo() {
30 super(DisplayTestInfoExtractor
.CLASS_FULL_NAME
);
33 public void readFrom(final ObjectReader reader
) {
34 myMethod
= reader
.readLimitedString();
38 public String
getName() {
43 public Location
getLocation(final Project project
) {
44 final Location
<PsiClass
> classLocation
= (Location
<PsiClass
>)super.getLocation(project
);
45 if (classLocation
== null) return null;
46 String strippedMethodName
= myMethod
; //navigation to for parametr. methods
47 final int idx
= myMethod
.indexOf('[');
49 strippedMethodName
= myMethod
.substring(0, idx
);
51 final PsiMethod method
= MethodSignatureUtil
.findMethodBySignature(classLocation
.getPsiElement(),
52 MethodSignatureUtil
.createMethodSignature(strippedMethodName
, PsiType
.EMPTY_ARRAY
, PsiTypeParameter
.EMPTY_ARRAY
, PsiSubstitutor
.EMPTY
), true);
54 return new MethodLocation(project
, method
, classLocation
);
58 public boolean shouldRun() {