You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@zeppelin.apache.org by "proceane (via GitHub)" <gi...@apache.org> on 2025/08/10 11:23:33 UTC
[PR] [ZEPPELIN-6273] Add unit test for AngularInterpreter [zeppelin]
proceane opened a new pull request, #5021:
URL: https://github.com/apache/zeppelin/pull/5021
### What is this PR for?
Since there is currently no test class that can test AngularInterpreter, I added unit tests for `org.apache.zeppelin.angular.AngularInterpreter` to cover the core behavior.
- Verify interpret echoes input with Type.ANGULAR and Code.SUCCESS
- Verify empty input returns Type.ANGULAR with empty data
- Verify cancel does not throw
- Verify completion returns empty list
- Verify getFormType() returns FormType.NATIVE
- Verify getProgress() returns 0
- Verify scheduler is FIFOScheduler and name contains AngularInterpreter
### What type of PR is it?
Improvement
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-6273
### How should this be tested?
* In the angular module, run test.
### Questions:
* Does the license files need to update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@zeppelin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ZEPPELIN-6273] Add unit test for AngularInterpreter [zeppelin]
Posted by "ParkGyeongTae (via GitHub)" <gi...@apache.org>.
ParkGyeongTae commented on code in PR #5021:
URL: https://github.com/apache/zeppelin/pull/5021#discussion_r2265289084
##########
angular/src/test/java/org/apache/zeppelin/angular/AngularInterpreterTest.java:
##########
@@ -0,0 +1,85 @@
+package org.apache.zeppelin.angular;
+
+import org.apache.zeppelin.interpreter.Interpreter;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
+import org.apache.zeppelin.scheduler.FIFOScheduler;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.jupiter.api.Assertions.*;
Review Comment:
Please replace the wildcard import with explicit imports for the specific `Assertions` methods used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@zeppelin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ZEPPELIN-6273] Add unit test for AngularInterpreter [zeppelin]
Posted by "ParkGyeongTae (via GitHub)" <gi...@apache.org>.
ParkGyeongTae merged PR #5021:
URL: https://github.com/apache/zeppelin/pull/5021
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@zeppelin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ZEPPELIN-6273] Add unit test for AngularInterpreter [zeppelin]
Posted by "ParkGyeongTae (via GitHub)" <gi...@apache.org>.
ParkGyeongTae commented on PR #5021:
URL: https://github.com/apache/zeppelin/pull/5021#issuecomment-3219870849
Merged into master and branch-0.12
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@zeppelin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ZEPPELIN-6273] Add unit test for AngularInterpreter [zeppelin]
Posted by "ParkGyeongTae (via GitHub)" <gi...@apache.org>.
ParkGyeongTae commented on code in PR #5021:
URL: https://github.com/apache/zeppelin/pull/5021#discussion_r2265289623
##########
angular/src/test/java/org/apache/zeppelin/angular/AngularInterpreterTest.java:
##########
@@ -0,0 +1,85 @@
+package org.apache.zeppelin.angular;
+
+import org.apache.zeppelin.interpreter.Interpreter;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
+import org.apache.zeppelin.scheduler.FIFOScheduler;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class AngularInterpreterTest {
+
+ private AngularInterpreter angular;
+ private InterpreterContext context;
+
+ @BeforeEach
+ void setUp() {
+ Properties p = new Properties();
+ angular = new AngularInterpreter(p);
+ angular.open();
+ context = InterpreterContext.builder()
+ .setParagraphId("paragraphId")
+ .build();
+ }
+
+ @AfterEach
+ void tearDown() {
+ if (angular != null) {
+ angular.close();
+ }
+ }
+
+ @Test
+ void testInterpret() {
+ String input = "<div>{{value}}</div>\n<span ng-if=\"cond\">ok</span>";
+ InterpreterResult res = angular.interpret(input, context);
+
+ assertEquals(InterpreterResult.Code.SUCCESS, res.code());
+ assertEquals(1, res.message().size());
+ assertEquals(InterpreterResult.Type.ANGULAR, res.message().get(0).getType());
+ assertEquals(input, res.message().get(0).getData());
+ }
+
+ @Test
+ void testEmptyStringIsSuccess() {
+ InterpreterResult res = angular.interpret("", context);
+
+ assertEquals(InterpreterResult.Code.SUCCESS, res.code());
+ assertEquals(InterpreterResult.Type.ANGULAR, res.message().get(0).getType());
+ assertEquals("", res.message().get(0).getData());
+ }
+
+ @Test
+ void testCancelNotThrow() {
+ assertDoesNotThrow(() -> angular.cancel(context));
+ }
+
+ @Test
+ void testCompletionIsEmpty() {
+ List<InterpreterCompletion> comps = angular.completion("{{value}}", 3, context);
+ assertTrue(comps.isEmpty());
+ }
+
+ @Test
+ void testFormTypeIsNative() {
+ assertEquals(Interpreter.FormType.NATIVE, angular.getFormType());
+ }
+
+ @Test
+ void testProgressIsZero() {
+ assertEquals(0, angular.getProgress(context));
+ }
+
+ @Test
+ void testSchedulerIsFIFOSchedulerInstance() {
+ assertTrue(angular.getScheduler() instanceof FIFOScheduler);
+ assertTrue(angular.getScheduler().getName().contains(AngularInterpreter.class.getName()));
+ }
+}
Review Comment:
Please add a newline character at the end of this file.
`Error: src/test/java/org/apache/zeppelin/angular/AngularInterpreterTest.java:[1] (misc) NewlineAtEndOfFile: File does not end with a newline.
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@zeppelin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ZEPPELIN-6273] Add unit test for AngularInterpreter [zeppelin]
Posted by "ParkGyeongTae (via GitHub)" <gi...@apache.org>.
ParkGyeongTae commented on code in PR #5021:
URL: https://github.com/apache/zeppelin/pull/5021#discussion_r2265288046
##########
angular/src/test/java/org/apache/zeppelin/angular/AngularInterpreterTest.java:
##########
@@ -0,0 +1,85 @@
+package org.apache.zeppelin.angular;
Review Comment:
You should add the Apache license header to `angular/src/test/java/org/apache/zeppelin/angular/AngularInterpreterTest.java`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@zeppelin.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org