Code review comment: ```suggestion                         "function mocking is not supported with standalone Ballerina files"); ```

Code before review:
public void process(SimpleVariableNode simpleVariableNode, List<AnnotationAttachmentNode> annotations) {
BLangPackage parent = (BLangPackage) ((BLangSimpleVariable) simpleVariableNode).parent;
String packageName = getPackageName(parent);
annotations = annotations.stream().distinct().collect(Collectors.toList());
for (AnnotationAttachmentNode attachmentNode : annotations) {
if (packageName.equals(DOT)) {
diagnosticLog.logDiagnostic(
DiagnosticSeverity.ERROR, (ModuleDescriptor) null, attachmentNode.getPosition(),
"function mocking is not supported for single file projects");
return;
}
String annotationName = attachmentNode.getAnnotationName().getValue();
if (MOCK_ANNOTATION_NAME.equals(annotationName)) {
String type = ((BLangUserDefinedType) ((BLangSimpleVariable) simpleVariableNode).typeNode).
typeName.getValue();
if (type.equals("MockFunction")) {
String mockFnObjectName = simpleVariableNode.getName().getValue();
String[] annotationValues = new String[2];
annotationValues[0] = packageName;
if (null == attachmentNode.getExpression()
|| attachmentNode.getExpression().getKind() != NodeKind.RECORD_LITERAL_EXPR) {
diagnosticLog.logDiagnostic(DiagnosticSeverity.ERROR, attachmentNode.getPosition(),
"annotation should be a record with 'functionName' and 'moduleName'(optional) fields");
continue;
}
List<RecordLiteralNode.RecordField> fields =
((BLangRecordLiteral) attachmentNode.getExpression()).getFields();
setAnnotationValues(fields, annotationValues, attachmentNode, parent);
PackageID functionToMockID = getPackageID(annotationValues[0]);
boolean validFunctionName = isValidFunctionName(
annotationValues[1], annotationValues[0], functionToMockID, attachmentNode);
if (!validFunctionName) {
return;
}
BLangTestablePackage bLangTestablePackage =
(BLangTestablePackage) ((BLangSimpleVariable) simpleVariableNode).parent;
bLangTestablePackage.addMockFunction(
functionToMockID + MOCK_FN_DELIMITER + annotationValues[1],
mockFnObjectName);
if (functionToMockID != null) {
String className = getQualifiedClassName(bLangTestablePackage,
functionToMockID.toString(), annotationValues[1]);
registry.addMockFunctionsSourceMap(bLangTestablePackage.packageID.getName().toString()
+ MODULE_DELIMITER + className + MOCK_FN_DELIMITER + annotationValues[1],
mockFnObjectName);
}
} else {
diagnosticLog.logDiagnostic(DiagnosticSeverity.ERROR, attachmentNode.getPosition(),
"Annotation can only be attached to a test:MockFunction object");
}
}
}
}

Line under review: "function mocking is not supported for single file projects");

Code after addressing the review:
public void process(SimpleVariableNode simpleVariableNode, List<AnnotationAttachmentNode> annotations) {
BLangPackage parent = (BLangPackage) ((BLangSimpleVariable) simpleVariableNode).parent;
String packageName = getPackageName(parent);
annotations = annotations.stream().distinct().collect(Collectors.toList());
for (AnnotationAttachmentNode attachmentNode : annotations) {
if (packageName.equals(DOT)) {
diagnosticLog.logDiagnostic(
DiagnosticSeverity.ERROR, (ModuleDescriptor) null, attachmentNode.getPosition(),
"function mocking is not supported with standalone Ballerina files");
return;
}
String annotationName = attachmentNode.getAnnotationName().getValue();
if (MOCK_ANNOTATION_NAME.equals(annotationName)) {
String type = ((BLangUserDefinedType) ((BLangSimpleVariable) simpleVariableNode).typeNode).
typeName.getValue();
if (type.equals("MockFunction")) {
String mockFnObjectName = simpleVariableNode.getName().getValue();
String[] annotationValues = new String[2];
annotationValues[0] = packageName;
if (null == attachmentNode.getExpression()
|| attachmentNode.getExpression().getKind() != NodeKind.RECORD_LITERAL_EXPR) {
diagnosticLog.logDiagnostic(DiagnosticSeverity.ERROR, attachmentNode.getPosition(),
"missing required 'functionName' field");
continue;
}
List<RecordLiteralNode.RecordField> fields =
((BLangRecordLiteral) attachmentNode.getExpression()).getFields();
setAnnotationValues(fields, annotationValues, attachmentNode, parent);
PackageID functionToMockID = getPackageID(annotationValues[0]);
boolean validFunctionName = isValidFunctionName(
annotationValues[1], annotationValues[0], functionToMockID, attachmentNode);
if (!validFunctionName) {
return;
}
BLangTestablePackage bLangTestablePackage =
(BLangTestablePackage) ((BLangSimpleVariable) simpleVariableNode).parent;
bLangTestablePackage.addMockFunction(
functionToMockID + MOCK_FN_DELIMITER + annotationValues[1],
mockFnObjectName);
if (functionToMockID != null) {
String className = getQualifiedClassName(bLangTestablePackage,
functionToMockID.toString(), annotationValues[1]);
registry.addMockFunctionsSourceMap(bLangTestablePackage.packageID.getName().toString()
+ MODULE_DELIMITER + className + MOCK_FN_DELIMITER + annotationValues[1],
mockFnObjectName);
}
} else {
diagnosticLog.logDiagnostic(DiagnosticSeverity.ERROR, attachmentNode.getPosition(),
"Annotation can only be attached to a test:MockFunction object");
}
}
}
}