From 2d8d0b922c9228d471c023063c4f11cec696156d Mon Sep 17 00:00:00 2001
From: igarash1 <kigrsk@gmail.com>
Date: Fri, 8 Jun 2018 11:53:37 +0900
Subject: [PATCH] create KuromojiCSVUtilTest.java
---
.../fess/util/KuromojiCSVUtilTest.java | 66 +++++++++++++++++++
1 file changed, 66 insertions(+)
create mode 100644 src/test/java/org/codelibs/fess/util/KuromojiCSVUtilTest.java
diff --git a/src/test/java/org/codelibs/fess/util/KuromojiCSVUtilTest.java b/src/test/java/org/codelibs/fess/util/KuromojiCSVUtilTest.java
new file mode 100644
index 000000000..059264ad5
--- /dev/null
+++ b/src/test/java/org/codelibs/fess/util/KuromojiCSVUtilTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2012-2018 CodeLibs Project and the Others.
+ *
+ * Licensed 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.codelibs.fess.util;
+
+import java.util.List;
+import java.util.Arrays;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import org.codelibs.fess.unit.UnitFessTestCase;
+
+public class KuromojiCSVUtilTest extends UnitFessTestCase {
+ public void test_parse() {
+ String value;
+ List<String> expected;
+ List<String> actual;
+
+ value = "フェス";
+ expected = Arrays.asList("フェス");
+ actual = Arrays.asList(KuromojiCSVUtil.parse(value));
+ assertThat(actual, is(expected));
+
+ value = "フェス,Fess";
+ expected = Arrays.asList("フェス", "Fess");
+ actual = Arrays.asList(KuromojiCSVUtil.parse(value));
+ assertThat(actual, is(expected));
+
+ value = "Fess,フェス";
+ expected = Arrays.asList("Fess", "フェス");
+ actual = Arrays.asList(KuromojiCSVUtil.parse(value));
+ assertThat(actual, is(expected));
+
+ value = "\"Fess,FESS\"";
+ expected = Arrays.asList("\"Fess,FESS\"");
+ actual = Arrays.asList(KuromojiCSVUtil.parse(value));
+ assertThat(actual, is(expected));
+
+ value = " ";
+ expected = Arrays.asList(" ");
+ actual = Arrays.asList(KuromojiCSVUtil.parse(value));
+ assertThat(actual, is(expected));
+
+ value = "";
+ expected = Arrays.asList("");
+ actual = Arrays.asList(KuromojiCSVUtil.parse(value));
+ assertThat(actual, is(expected));
+
+ value = "\"Fess\"Fess\"";
+ expected = Arrays.asList();
+ actual = Arrays.asList(KuromojiCSVUtil.parse(value));
+ assertThat(actual, is(expected));
+ }
+}
\ No newline at end of file
--
GitLab