You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by ca...@apache.org on 2022/04/29 15:51:46 UTC

[incubator-linkis] 09/11: add junit test

This is an automated email from the ASF dual-hosted git repository.

casion pushed a commit to branch dev-1.1.2
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git

commit b6fcd5c4ef431845e04d85a366f7af954bc723a6
Author: peacewong <wp...@gmail.com>
AuthorDate: Fri Apr 29 14:45:23 2022 +0800

    add junit test
---
 .../governance/common/utils/JobUtilsTest.scala     | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/linkis-computation-governance/linkis-computation-governance-common/src/test/scala/org/apache/linkis/governance/common/utils/JobUtilsTest.scala b/linkis-computation-governance/linkis-computation-governance-common/src/test/scala/org/apache/linkis/governance/common/utils/JobUtilsTest.scala
new file mode 100644
index 000000000..bfeb038ee
--- /dev/null
+++ b/linkis-computation-governance/linkis-computation-governance-common/src/test/scala/org/apache/linkis/governance/common/utils/JobUtilsTest.scala
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.governance.common.utils
+
+import org.apache.linkis.governance.common.constant.job.JobRequestConstants
+import org.junit.jupiter.api.{Assertions, DisplayName, Test}
+
+import java.util
+
+class JobUtilsTest {
+
+  @Test
+  @DisplayName("testGetJobIdFromMap")
+  def testGetJobIdFromMap(): Unit = {
+    val map: util.Map[String, Object] = new util.HashMap[String, Object]()
+    Assertions.assertNull(JobUtils.getJobIdFromMap(map))
+    map.put(JobRequestConstants.JOB_ID, 100L)
+    Assertions.assertNotNull(JobUtils.getJobIdFromMap(map))
+  }
+
+  @Test
+  @DisplayName("getJobIdFromStringMap")
+  def testGetJobIdFromStringMap(): Unit = {
+    val map: util.Map[String, String] = new util.HashMap[String, String]()
+    Assertions.assertNull(JobUtils.getJobIdFromStringMap(map))
+    map.put(JobRequestConstants.JOB_ID, "100")
+    Assertions.assertNotNull(JobUtils.getJobIdFromStringMap(map))
+  }
+
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org