You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2023/03/31 01:28:21 UTC

[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #1809: feat(bindings/java): add cucumber test case for memory

Xuanwo commented on code in PR #1809:
URL: https://github.com/apache/incubator-opendal/pull/1809#discussion_r1153927122


##########
bindings/java/src/test/java/org/apache/opendal/StepsTest.java:
##########
@@ -0,0 +1,58 @@
+package org.apache.opendal;
+
+import io.cucumber.java.en.Given;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class StepsTest {
+
+    Operator operator;
+
+    @Given("A new OpenDAL Blocking Operator")
+    public void a_new_open_dal_blocking_operator() {
+        Map<String, String> params = new HashMap<>();
+        params.put("root", "/tmp");
+        this.operator = new Operator("Memory", params);
+    }
+
+    @When("Blocking write path \"test\" with content \"Hello, World!\"")
+    public void blocking_write_path_test_with_content_hello_world() {
+        this.operator.write("test", "Hello, World!");
+    }
+
+
+    @Then("The blocking file \"test\" should exist")
+    public void the_blocking_file_test_should_exist() {
+
+    }
+
+
+    @Then("The blocking file \"test\" entry mode must be file")
+    public void the_blocking_file_test_entry_mode_must_be_file() {
+        // Write code here that turns the phrase above into concrete actions
+//        throw new io.cucumber.java.PendingException();
+    }
+
+    @Then("The blocking file \"test\" content length must be 13")
+    public void the_blocking_file_test_content_length_must_be_13() {
+        // Write code here that turns the phrase above into concrete actions

Review Comment:
   Please remove not useful comment



##########
bindings/java/src/test/java/org/apache/opendal/operator/OperatorTest.java:
##########


Review Comment:
   Please delete this file as we will not be adding any additional tests for bindings (for now).



##########
bindings/java/src/test/java/org/apache/opendal/StepsTest.java:
##########
@@ -0,0 +1,58 @@
+package org.apache.opendal;
+
+import io.cucumber.java.en.Given;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class StepsTest {
+
+    Operator operator;
+
+    @Given("A new OpenDAL Blocking Operator")
+    public void a_new_open_dal_blocking_operator() {
+        Map<String, String> params = new HashMap<>();
+        params.put("root", "/tmp");
+        this.operator = new Operator("Memory", params);
+    }
+
+    @When("Blocking write path \"test\" with content \"Hello, World!\"")
+    public void blocking_write_path_test_with_content_hello_world() {
+        this.operator.write("test", "Hello, World!");
+    }
+
+
+    @Then("The blocking file \"test\" should exist")
+    public void the_blocking_file_test_should_exist() {
+
+    }
+
+
+    @Then("The blocking file \"test\" entry mode must be file")
+    public void the_blocking_file_test_entry_mode_must_be_file() {
+        // Write code here that turns the phrase above into concrete actions
+//        throw new io.cucumber.java.PendingException();
+    }
+
+    @Then("The blocking file \"test\" content length must be 13")
+    public void the_blocking_file_test_content_length_must_be_13() {
+        // Write code here that turns the phrase above into concrete actions
+        String content = this.operator.read("test");

Review Comment:
   Does `cucumber` support capturing the value we input? It would be better to refer to a variable instead of manually writing `"test"` here.
   
   For example:
   
   https://github.com/apache/incubator-opendal/blob/85c3785d5ff2543278325788916da43fe2dc91e9/bindings/python/tests/steps/binding.py#L38-L50



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org