Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.ballerina.runtime.internal.types.semtype.CellAtomicType;
import io.ballerina.runtime.internal.types.semtype.ListDefinition;
import org.testng.annotations.Test;
import org.testng.Assert;

public class CoreTests {

Expand All @@ -35,11 +36,11 @@ public void testCellTypes() {
Context cx = Context.from(env);
SemType intTy = Builder.getIntType();
SemType readonlyInt = Builder.getCellContaining(env, intTy, CellAtomicType.CellMutability.CELL_MUT_NONE);
assert Core.isSubType(cx, readonlyInt, readonlyInt);
Assert.assertTrue(Core.isSubType(cx, readonlyInt, readonlyInt));
SemType mutableInt = Builder.getCellContaining(env, intTy, CellAtomicType.CellMutability.CELL_MUT_UNLIMITED);
assert Core.isSubType(cx, mutableInt, mutableInt);
assert Core.isSubType(cx, readonlyInt, mutableInt);
assert !Core.isSubType(cx, mutableInt, readonlyInt);
Assert.assertTrue(Core.isSubType(cx, mutableInt, mutableInt));
Assert.assertTrue(Core.isSubType(cx, readonlyInt, mutableInt));
Assert.assertTrue(!Core.isSubType(cx, mutableInt, readonlyInt));
}

@Test
Expand All @@ -48,7 +49,7 @@ public void testCellTypeCaching() {
SemType intTy = Builder.getIntType();
SemType readonlyInt1 = Builder.getCellContaining(env, intTy, CellAtomicType.CellMutability.CELL_MUT_NONE);
SemType readonlyInt2 = Builder.getCellContaining(env, intTy, CellAtomicType.CellMutability.CELL_MUT_NONE);
assert readonlyInt1 == readonlyInt2;
Assert.assertEquals(readonlyInt1, readonlyInt2);
}

@Test
Expand All @@ -69,6 +70,6 @@ public void testSimpleList() {
CellAtomicType.CellMutability.CELL_MUT_UNLIMITED);

Context cx = Context.from(env);
assert Core.isSubType(cx, intListTy1, intListTy);
Assert.assertTrue(Core.isSubType(cx, intListTy1, intListTy));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void test(String config) throws IOException, WorkspaceDocumentException {
if (actualCommand.get("command").getAsString().equals("ADD_DOC")) {
JsonObject actualNodeRange = getNodeRange(actualArgs);
JsonObject expNodeRange = getNodeRange(expArgs);
assert actualNodeRange != null;
Assert.assertNotNull(actualNodeRange);
if (!actualNodeRange.equals(expNodeRange)) {
misMatched = true;
JsonArray newArgs = getNodeRangeArgument(actualArgs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void testGetDependencyFilePathFromBuildProject() throws IOException {
}
}
}
assert filepath != null;
Assert.assertNotNull(filepath);
Path expectedPath = Path.of("build/repo/bala/samjs/package_b/0.1.0/any/modules/package_b.mod_b1")
.resolve("mod1.bal").toAbsolutePath();
Assert.assertEquals(filepath.toString(), expectedPath.toString());
Expand Down Expand Up @@ -167,7 +167,7 @@ public void testGetLangLibFilePath() throws IOException {
}
}

assert filepath != null;
Assert.assertNotNull(filepath);
Path expectedPath = Path.of("build/repo/bala/ballerina/lang.float/0.0.0/any/modules/lang.float")
.resolve("float.bal").toAbsolutePath();
Assert.assertEquals(filepath.toString(), expectedPath.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Object[][] createTypeCellDisparityTestData() {

@Test(description = "Test basic cell subtyping", dataProvider = "basicCellSubtypingDataProvider")
public void testBasicCellSubtyping(SemType t1, SemType t2, Relation[] relations) {
assert relations.length == 3;
Assert.assertEquals(relations.length, 3);
Relation[] actual = new Relation[3];

CellAtomicType.CellMutability[] values = CellAtomicType.CellMutability.values();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void testSymbolLookupWithAnnotationOnFunction() {

List<String> expectedNameList = asList("SimpleRecordTYPE_DEFINITION", "func1ANNOTATION", "func1FUNCTION");

assert symbolStringList.containsAll(expectedNameList);
assertTrue(symbolStringList.containsAll(expectedNameList));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import java.util.Map;
import java.util.StringJoiner;
import java.util.function.Function;
import org.testng.Assert;

import static org.ballerinalang.test.util.TestConstant.CONFIGURATION_CLASS_NAME;
import static org.ballerinalang.test.util.TestConstant.MODULE_INIT_CLASS_NAME;
Expand Down Expand Up @@ -150,7 +151,7 @@ private static Object invokeOnJBallerina(CompileResult compileResult, String fun
*/
private static Object invoke(CompileResult compileResult, BIRNode.BIRFunction function, String functionName,
Object[] args, Class<?>[] paramTypes) {
assert args.length == paramTypes.length;
Assert.assertEquals(args.length, paramTypes.length);
PackageManifest packageManifest = compileResult.packageManifest();
String funcClassName = JarResolver.getQualifiedClassName(packageManifest.org().toString(),
packageManifest.name().toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
import org.testng.Assert;

import static org.ballerinalang.test.context.Constant.BALLERINA_AGENT_PATH;

Expand Down Expand Up @@ -110,13 +111,13 @@ public void startServer(String balFile) throws BallerinaTestException {

@Override
public void startServer(String balFile, boolean useBallerinaRunCommand) throws BallerinaTestException {
assert requiredPorts.length < 20 : "test try to open too many ports : " + requiredPorts.length;
Assert.assertTrue(requiredPorts.length < 20, "test try to open too many ports : " + requiredPorts.length);
startServer(balFile, new String[] { "--experimental" }, null, null, requiredPorts, true);
}

@Override
public void startServer(String balFile, int[] requiredPorts) throws BallerinaTestException {
assert requiredPorts.length < 20 : "test try to open too many ports : " + requiredPorts.length;
Assert.assertTrue(requiredPorts.length < 20, "test try to open too many ports : " + requiredPorts.length);
startServer(balFile, new String[] { "--experimental" }, null, requiredPorts);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import java.util.Map;
import java.util.Set;
import java.util.stream.Stream;
import org.testng.Assert;

import static org.ballerinalang.model.tree.NodeKind.CONSTANT;
import static org.wso2.ballerinalang.compiler.semantics.analyzer.SymbolEnter.getTypeOrClassName;
Expand Down Expand Up @@ -251,8 +252,8 @@ private SemType resolveNonDistinctObject(TypeTestContext<SemType> cx, Map<String
private static ObjectQualifiers getQualifiers(BLangObjectTypeNode td) {
Set<Flag> flags = td.symbol.getFlags();
ObjectQualifiers.NetworkQualifier networkQualifier;
assert !(flags.contains(Flag.CLIENT) && flags.contains(Flag.SERVICE)) :
"object can't be both client and service";
Assert.assertFalse(flags.contains(Flag.CLIENT) && flags.contains(Flag.SERVICE),
"object can't be both client and service");
if (flags.contains(Flag.CLIENT)) {
networkQualifier = ObjectQualifiers.NetworkQualifier.Client;
} else if (flags.contains(Flag.SERVICE)) {
Expand Down Expand Up @@ -689,7 +690,7 @@ private SemType resolveSingletonType(Object value, TypeKind targetTypeKind) {
case NIL -> PredefinedType.NIL;
case BOOLEAN -> SemTypes.booleanConst((Boolean) value);
case INT, BYTE -> {
assert !(value instanceof Byte);
Assert.assertFalse(value instanceof Byte);
yield SemTypes.intConst(((Number) value).longValue());
}
case FLOAT -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
import static io.ballerina.runtime.api.constants.RuntimeConstants.UNSIGNED8_MAX_VALUE;
import static io.ballerina.runtime.internal.types.semtype.CellAtomicType.CellMutability.CELL_MUT_LIMITED;
import static io.ballerina.runtime.internal.types.semtype.CellAtomicType.CellMutability.CELL_MUT_NONE;
import org.testng.Assert;

/**
* Resolves sem-types for module definitions using runtime side semtype implementation.
Expand Down Expand Up @@ -264,8 +265,8 @@ private SemType resolveNonDistinctObject(TypeTestContext<SemType> cx, Map<String
private ObjectQualifiers getQualifiers(BLangObjectTypeNode td) {
Set<Flag> flags = td.symbol.getFlags();
ObjectQualifiers.NetworkQualifier networkQualifier;
assert !(flags.contains(Flag.CLIENT) && flags.contains(Flag.SERVICE)) :
"object can't be both client and service";
Assert.assertFalse(flags.contains(Flag.CLIENT) && flags.contains(Flag.SERVICE),
"object can't be both client and service");
if (flags.contains(Flag.CLIENT)) {
networkQualifier = ObjectQualifiers.NetworkQualifier.Client;
} else if (flags.contains(Flag.SERVICE)) {
Expand Down Expand Up @@ -563,7 +564,7 @@ private Optional<SemType> resolveSingletonType(Object value, TypeKind targetType
case NIL -> Optional.of(Builder.getNilType());
case BOOLEAN -> Optional.of(Builder.getBooleanConst((Boolean) value));
case INT, BYTE -> {
assert !(value instanceof Byte);
Assert.assertFalse(value instanceof Byte);
yield Optional.of(Builder.getIntConst(((Number) value).longValue()));
}
case FLOAT -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package io.ballerina.semtype.port.test;

import java.nio.file.Paths;
import org.testng.Assert;

/**
* Subtype test.
Expand All @@ -37,8 +38,8 @@ public record TypeAssertion<SemType>(TypeTestContext<SemType> context, String fi

public TypeAssertion {
if (kind != null) {
assert lhs != null;
assert rhs != null;
Assert.assertNotNull(lhs);
Assert.assertNotNull(rhs);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public void tearDown() {
public static Object getMethodAnnotations(BTypedesc bTypedesc, BString method, BString annotName) {
Type describingType = TypeUtils.getImpliedType(bTypedesc.getDescribingType());
int tag = describingType.getTag();
assert tag == TypeTags.OBJECT_TYPE_TAG || tag == TypeTags.SERVICE_TAG;
Assert.assertTrue(tag == TypeTags.OBJECT_TYPE_TAG || tag == TypeTags.SERVICE_TAG);

ObjectType objectType = (ObjectType) describingType;
String methodName = method.getValue();
Expand Down
Loading