package name.valery1707.kazPersonId;

import org.junit.Test;

import static com.google.common.truth.Truth.assertThat;

public class BasePersonIdTest {

	@Test
	public void testIsValid() throws Exception {
		BasePersonId id;

		id = new JuridicalPersonId(null);
		assertThat(id.isValidPattern()).isFalse();
		assertThat(id.isValidCRC()).isFalse();
		assertThat(id.isValid()).isFalse();

		id = new JuridicalPersonId("");
		assertThat(id.isValidPattern()).isFalse();
		assertThat(id.isValidCRC()).isFalse();
		assertThat(id.isValid()).isFalse();

		id = new JuridicalPersonId("0123456789AB");
		assertThat(id.isValidPattern()).isFalse();
		assertThat(id.isValidCRC()).isFalse();
		assertThat(id.isValid()).isFalse();

		id = new JuridicalPersonId("940140000380");
		assertThat(id.isValidPattern()).isTrue();
		assertThat(id.isValidCRC()).isFalse();
		assertThat(id.isValid()).isFalse();
	}
}
@@ -880,10 +880,941 @@
 se();%0A%09%7D
+%0A%0A%09private BasePersonId id1() %7B%0A%09%09return new JuridicalPersonId(%22940140000385%22);%0A%09%7D%0A%0A%09private BasePersonId id2() %7B%0A%09%09return new JuridicalPersonId(%22950341000052%22);%0A%09%7D%0A%0A%09@Test%0A%09@SuppressWarnings(%22EqualsWithItself%22)%0A%09public void testEquals() throws Exception %7B%0A%09%09BasePersonId idNull = new JuridicalPersonId(null);%0A%09%09BasePersonId id1 = id1();%0A%09%09BasePersonId id2 = id2();%0A%0A%09%09assertThat(idNull).isEqualTo(idNull);%0A%09%09assertThat(idNull.equals(idNull)).isTrue();%0A%09%09assertThat(idNull).isEqualTo(new JuridicalPersonId(null));%0A%09%09assertThat(idNull).isNotEqualTo(%22%22);%0A%09%09assertThat(idNull).isNotEqualTo(id1);%0A%09%09assertThat(idNull).isNotEqualTo(id2);%0A%0A%09%09assertThat(id1).isNotEqualTo(idNull);%0A%09%09assertThat(id1).isEqualTo(id1);%0A%09%09assertThat(id1).isEqualTo(id1());%0A%09%09assertThat(id1).isNotEqualTo(id2);%0A%0A%09%09assertThat(id2).isNotEqualTo(idNull);%0A%09%09assertThat(id2).isNotEqualTo(id1);%0A%09%09assertThat(id2).isEqualTo(id2);%0A%09%09assertThat(id2).isEqualTo(id2());%0A%09%7D
 %0A%7D

Test BasePersonId#equals()