package jetbrains.mps.baseLanguage.unitTest.execution.client;
/*Generated by MPS */
import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.annotations.Nullable;
import jetbrains.mps.smodel.behaviour.BHReflection;
import jetbrains.mps.core.aspects.behaviour.SMethodTrimmedId;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import jetbrains.mps.internal.collections.runtime.ListSequence;
import org.jetbrains.mps.openapi.persistence.PersistenceFacade;
import jetbrains.mps.smodel.SModelUtil_new;
import jetbrains.mps.smodel.SReference;
public class JUnit4MethodWrapper extends AbstractTestWrapper<SNode> {
public JUnit4MethodWrapper(SNode method) {
super(method);
}
@Override
public boolean isTestCase() {
return false;
}
@Nullable
@Override
public ITestNodeWrapper getTestCase() {
SNode clazz = check_lclll2_a0a0e(getNode(), this);
if ((clazz != null)) {
return new JUnit3TestWrapper(clazz);
}
return null;
}
public static boolean isJUnit4TestMethod(SNode method) {
if (!(((boolean) (Boolean) BHReflection.invoke(method, SMethodTrimmedId.create("isAbstract", null, "hWjv7RO")))) && (SLinkOperations.getTarget(method, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x112670d273fL, 0x112670d886aL, "visibility")) != null) && SNodeOperations.isInstanceOf(SLinkOperations.getTarget(method, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x112670d273fL, 0x112670d886aL, "visibility")), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10af9581ff1L, "jetbrains.mps.baseLanguage.structure.PublicVisibility")) && (SPropertyOperations.getString(method, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")) != null)) {
boolean hasTestAnnotation = false;
for (SNode annotation : ListSequence.fromList(SLinkOperations.getChildren(method, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6be947aL, 0x114a6beb0bdL, "annotation")))) {
if (eq_lclll2_a0a0b0a0g(check_lclll2_a0a0b0a0g(annotation), SLinkOperations.getTarget(_quotation_createNode_lclll2_a0a0a1a0a6(), MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6b4ccabL, 0x114a6b85d40L, "annotation")))) {
return false;
}
if (!(hasTestAnnotation) && eq_lclll2_a0a1a1a0a6(check_lclll2_a0a1a1a0a6(annotation), SLinkOperations.getTarget(_quotation_createNode_lclll2_a0a0b0b0a0g(), MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6b4ccabL, 0x114a6b85d40L, "annotation")))) {
hasTestAnnotation = true;
}
}
return hasTestAnnotation;
}
return false;
}
private static SNode check_lclll2_a0a0e(SNode checkedDotOperand, JUnit4MethodWrapper checkedDotThisExpression) {
if (null != checkedDotOperand) {
return SNodeOperations.getNodeAncestor(checkedDotOperand, MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c108ca66L, "jetbrains.mps.baseLanguage.structure.ClassConcept"), false, false);
}
return null;
}
private static SNode check_lclll2_a0a0b0a0g(SNode checkedDotOperand) {
if (null != checkedDotOperand) {
return SLinkOperations.getTarget(checkedDotOperand, MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6b4ccabL, 0x114a6b85d40L, "annotation"));
}
return null;
}
private static SNode _quotation_createNode_lclll2_a0a0a1a0a6() {
PersistenceFacade facade = PersistenceFacade.getInstance();
SNode quotedNode_1 = null;
quotedNode_1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0x114a6b4ccabL, "AnnotationInstance"), null, null, false);
quotedNode_1.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6b4ccabL, 0x114a6b85d40L, "annotation"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6b4ccabL, 0x114a6b85d40L, "annotation"), quotedNode_1, facade.createModelReference("83f155ff-422c-4b5a-a2f2-b459302dd215/java:org.junit(jetbrains.mps.baseLanguage.unitTest.libs/)"), facade.createNodeId("~Ignore")));
return quotedNode_1;
}
private static SNode check_lclll2_a0a1a1a0a6(SNode checkedDotOperand) {
if (null != checkedDotOperand) {
return SLinkOperations.getTarget(checkedDotOperand, MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6b4ccabL, 0x114a6b85d40L, "annotation"));
}
return null;
}
private static SNode _quotation_createNode_lclll2_a0a0b0b0a0g() {
PersistenceFacade facade = PersistenceFacade.getInstance();
SNode quotedNode_1 = null;
quotedNode_1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(MetaAdapterFactory.getLanguage(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, "jetbrains.mps.baseLanguage"), 0x114a6b4ccabL, "AnnotationInstance"), null, null, false);
quotedNode_1.setReference(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6b4ccabL, 0x114a6b85d40L, "annotation"), SReference.create(MetaAdapterFactory.getReferenceLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x114a6b4ccabL, 0x114a6b85d40L, "annotation"), quotedNode_1, facade.createModelReference("83f155ff-422c-4b5a-a2f2-b459302dd215/java:org.junit(jetbrains.mps.baseLanguage.unitTest.libs/)"), facade.createNodeId("~Test")));
return quotedNode_1;
}
private static boolean eq_lclll2_a0a0b0a0g(Object a, Object b) {
return (a != null ? a.equals(b) : a == b);
}
private static boolean eq_lclll2_a0a1a1a0a6(Object a, Object b) {
return (a != null ? a.equals(b) : a == b);
}
}