// Path: friendly-id/src/test/java/com/devskiller/friendly_id/IdUtil.java
// static boolean areEqualIgnoringLeadingZeros(String code1, String code2) {
// 	return areEqual(removeLeadingZeros(code1), removeLeadingZeros(code2));
// }


import org.junit.Test;
import static com.devskiller.friendly_id.IdUtil.areEqualIgnoringLeadingZeros;
import static io.vavr.test.Property.def;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.util.Objects.areEqual;
package com.devskiller.friendly_id;



public class Base62Test {

	@Test
	public void decodingValuePrefixedWithZeros() {
		assertThat(Base62.encode(Base62.decode("00001"))).isEqualTo("1");
		assertThat(Base62.encode(Base62.decode("01001"))).isEqualTo("1001");
		assertThat(Base62.encode(Base62.decode("00abcd"))).isEqualTo("abcd");
	}

	@Test
	public void shouldCheck128BitLimits() {
		assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() ->
				Base62.decode("1Vkp6axDWu5pI3q1xQO3oO0"));
	}

	@Test
	public void decodingIdShouldBeReversible() {
		def("areEqualIgnoringLeadingZeros(Base62.toFriendlyId(Base62.toUuid(id)), id)")
				.forAll(DataProvider.FRIENDLY_IDS)
// Path: friendly-id/src/test/java/com/devskiller/friendly_id/IdUtil.java
// static boolean areEqualIgnoringLeadingZeros(String code1, String code2) {
// 	return areEqual(removeLeadingZeros(code1), removeLeadingZeros(code2));
// }


// Path: friendly-id/src/test/java/com/devskiller/friendly_id/Base62Test.java
import org.junit.Test;
import static com.devskiller.friendly_id.IdUtil.areEqualIgnoringLeadingZeros;
import static io.vavr.test.Property.def;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.util.Objects.areEqual;

package com.devskiller.friendly_id;



public class Base62Test {

	@Test
	public void decodingValuePrefixedWithZeros() {
		assertThat(Base62.encode(Base62.decode("00001"))).isEqualTo("1");
		assertThat(Base62.encode(Base62.decode("01001"))).isEqualTo("1001");
		assertThat(Base62.encode(Base62.decode("00abcd"))).isEqualTo("abcd");
	}

	@Test
	public void shouldCheck128BitLimits() {
		assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() ->
				Base62.decode("1Vkp6axDWu5pI3q1xQO3oO0"));
	}

	@Test
	public void decodingIdShouldBeReversible() {
		def("areEqualIgnoringLeadingZeros(Base62.toFriendlyId(Base62.toUuid(id)), id)")
				.forAll(DataProvider.FRIENDLY_IDS)
				.suchThat(id -> areEqualIgnoringLeadingZeros(Base62.encode(Base62.decode(id)), id))