diff --git a/src/test/java/org/ansj/domain/PersonNatureAttrTest.java b/src/test/java/org/ansj/domain/PersonNatureAttrTest.java new file mode 100644 index 00000000..97c01eb8 --- /dev/null +++ b/src/test/java/org/ansj/domain/PersonNatureAttrTest.java @@ -0,0 +1,28 @@ +package org.ansj.domain; + +import org.ansj.exception.LibraryException; +import org.junit.Assert; +import org.junit.Test; + + +public class PersonNatureAttrTest { + + @Test + public void test1() { + try { + set(); + } catch (Exception e) { + System.out.println(e.getMessage()); + Assert.assertEquals(e.getMessage(), "person name status err a"); + } + } + + private void set() throws LibraryException { + PersonNatureAttr personNatureAttr = new PersonNatureAttr(); + try { + personNatureAttr.set('a', 1.0f); + } catch (Exception e) { + throw new LibraryException(e.getMessage()); + } + } +} diff --git a/src/test/java/org/ansj/domain/TermNatureTest.java b/src/test/java/org/ansj/domain/TermNatureTest.java new file mode 100644 index 00000000..ae8eec28 --- /dev/null +++ b/src/test/java/org/ansj/domain/TermNatureTest.java @@ -0,0 +1,15 @@ +package org.ansj.domain; + +import org.junit.Assert; +import org.junit.Test; + + +public class TermNatureTest { + + @Test + public void test1() { + TermNature termNature = new TermNature("a", 1); + System.out.println(termNature.toString()); + Assert.assertEquals(termNature.toString(), "a/1"); + } +} diff --git a/src/test/java/org/ansj/domain/TermNaturesTest.java b/src/test/java/org/ansj/domain/TermNaturesTest.java new file mode 100644 index 00000000..20a96dcb --- /dev/null +++ b/src/test/java/org/ansj/domain/TermNaturesTest.java @@ -0,0 +1,20 @@ +package org.ansj.domain; + +import org.junit.Assert; +import org.junit.Test; + + +public class TermNaturesTest { + + @Test + public void test1() { + TermNature termNature = new TermNature("a", 1); + TermNatures termNatures = new TermNatures(termNature); + PersonNatureAttr personNatureAttr = new PersonNatureAttr(); + termNatures.setPersonNatureAttr(personNatureAttr); + PersonNatureAttr personAttr = termNatures.personAttr; + System.out.println(PersonNatureAttr.NULL); + System.out.println(personAttr); + Assert.assertNotSame(personAttr, PersonNatureAttr.NULL); + } +} diff --git a/src/test/java/org/ansj/domain/TermTest.java b/src/test/java/org/ansj/domain/TermTest.java new file mode 100644 index 00000000..928791e0 --- /dev/null +++ b/src/test/java/org/ansj/domain/TermTest.java @@ -0,0 +1,33 @@ +package org.ansj.domain; + +import org.junit.Assert; +import org.junit.Test; + + +public class TermTest { + + @Test + public void test1() { + Term term = new Term("a", 1, "b", 2); + term.setOffe(3); + System.out.println(term.getOffe()); + Assert.assertEquals(term.getOffe(), 3); + } + + @Test + public void test2() { + Term term = new Term("a1", 11, "b1", 22); + term.setRealName("c1"); + Term term1 = term.merage(term); + System.out.println(term1.getRealName()); + Assert.assertEquals(term1.getRealName(), "c1c1"); + } + + @Test + public void test3() { + Term term = new Term("a", 1, "b", 2); + term.updateOffe(4); + System.out.println(term.getOffe()); + Assert.assertEquals(term.getOffe(), 5); + } +}