<dependency> <groupId>com.jcabi</groupId> <artifactId>jcabi-immutable</artifactId> <version>1.5</version> </dependency> import com.jcabi.immutable.Array; import com.jcabi.immutable.ArrayMap; import com.jcabi.immutable.LinkedList; import com.jcabi.immutable.MapEntry; import com.jcabi.immutable.ListMap; import com.jcabi.immutable.Table; public final class Person { private final String name; private final int age; public Person(String name, int age) { this.name = name; this.age = age; } public String getName() { return this.name; } public int getAge() { return this.age; } } import com.jcabi.immutable.EmptyMap; Table<Integer, String> table = new EmptyMap<Integer, String>().with( new MapEntry<>(1, "John"), new MapEntry<>(2, "Jane"), new MapEntry<>(3, "Doe") ); import com.jcabi.immutable.ArrayMap; import org.junit.Test; import static org.junit.Assert.assertEquals; public class PersonTest { @Test public void testGetName() { Person person = new Person("John", 30); assertEquals("John", person.getName()); } @Test public void testGetAge() { Person person = new Person("John", 30); assertEquals(30, person.getAge()); } }


上一篇:
下一篇:
切换中文