Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add PersonNatureAttrTest #775

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/test/java/org/ansj/domain/PersonNatureAttrTest.java
Original file line number Diff line number Diff line change
@@ -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());
}
}
}
15 changes: 15 additions & 0 deletions src/test/java/org/ansj/domain/TermNatureTest.java
Original file line number Diff line number Diff line change
@@ -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");
}
}
20 changes: 20 additions & 0 deletions src/test/java/org/ansj/domain/TermNaturesTest.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
33 changes: 33 additions & 0 deletions src/test/java/org/ansj/domain/TermTest.java
Original file line number Diff line number Diff line change
@@ -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);
}
}