-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nbauma109
committed
May 21, 2023
1 parent
00c33c8
commit 187095d
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/test/java/org/jd/core/v1/model/javasyntax/statement/LambdaExpressionStatementTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.jd.core.v1.model.javasyntax.statement; | ||
|
||
import org.jd.core.v1.model.javasyntax.expression.Expression; | ||
import org.jd.core.v1.model.javasyntax.expression.IntegerConstantExpression; | ||
import org.jd.core.v1.service.converter.classfiletojavasyntax.visitor.TestVisitor; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class LambdaExpressionStatementTest { | ||
|
||
@Test | ||
public void testLambdaExpressionStatement() { | ||
// Test constructor | ||
Expression expression = new IntegerConstantExpression(1, 10); | ||
LambdaExpressionStatement lambdaExpressionStatement = new LambdaExpressionStatement(expression); | ||
|
||
assertTrue(lambdaExpressionStatement.getExpression() instanceof IntegerConstantExpression); | ||
|
||
// Test setExpression method | ||
Expression newExpression = new IntegerConstantExpression(1, 20); | ||
lambdaExpressionStatement.setExpression(newExpression); | ||
|
||
assertEquals(newExpression, lambdaExpressionStatement.getExpression()); | ||
|
||
// Test the accept method with a simple visitor | ||
TestVisitor visitor = new TestVisitor(); | ||
lambdaExpressionStatement.accept(visitor); | ||
assertEquals(1, visitor.getLambdaExpressionStatementCount()); | ||
|
||
// Test toString method | ||
assertEquals("LambdaExpressionStatement{IntegerConstantExpression{type=PrimitiveType{primitive=maybe_byte}, value=20}}", | ||
lambdaExpressionStatement.toString()); | ||
|
||
// Test isLambdaExpressionStatement method | ||
assertTrue(lambdaExpressionStatement.isLambdaExpressionStatement()); | ||
} | ||
} |