SamSelector extends SeSelector { public static SamSelectorBuilder builder() { return new SamSelectorBuilder(); } private  SamSelector(SamSelectorBuilder builder); static SamSelectorBuilder builder(); SamRevision getTargetSamRevision(); byte[] getUnlockData();  }
@Test public void test_AidSelectorNull() { SamSelector samSelector = SamSelector.builder() .samIdentifier(SamIdentifier.builder().samRevision(SamRevision.S1D).build()) .build(); assertThat(samSelector.getAidSelector()).isNull(); }
@Test public void test_SamRevision_S1D() { SamSelector samSelector = SamSelector.builder() .samIdentifier(SamIdentifier.builder().samRevision(SamRevision.S1D).build()) .build(); assertThat(samSelector.getAtrFilter().getAtrRegex()) .isEqualTo("3B(.{6}|.{10})805A..80D?20.{4}.{8}829000"); }
@Test public void test_SamRevision_S1E() { SamSelector samSelector = SamSelector.builder() .samIdentifier(SamIdentifier.builder().samRevision(SamRevision.S1E).build()) .build(); assertThat(samSelector.getAtrFilter().getAtrRegex()) .isEqualTo("3B(.{6}|.{10})805A..80E120.{4}.{8}829000"); }
@Test public void test_SamRevision_C1() { SamSelector samSelector = SamSelector.builder() .samIdentifier(SamIdentifier.builder().samRevision(SamRevision.C1).build()) .build(); assertThat(samSelector.getAtrFilter().getAtrRegex()) .isEqualTo("3B(.{6}|.{10})805A..80C120.{4}.{8}829000"); }
@Test public void test_SamRevision_ANY() { SamSelector samSelector = SamSelector.builder() .samIdentifier(SamIdentifier.builder().samRevision(SamRevision.AUTO).build()) .build(); assertThat(samSelector.getAtrFilter().getAtrRegex()).isEqualTo(".*"); }
@Test public void test_SamSerialNumber() { SamSelector samSelector = SamSelector.builder().samRevision(SamRevision.C1).serialNumber("11223344").build(); assertThat(samSelector.getAtrFilter().getAtrRegex()) .isEqualTo("3B(.{6}|.{10})805A..80C120.{4}11223344829000"); }
@Test public void test_SamSerialNumber_SamIdentifier() { SamSelector samSelector = SamSelector.builder() .samIdentifier( new SamIdentifier.SamIdentifierBuilder() .samRevision(SamRevision.C1) .serialNumber("11223344") .build()) .build(); assertThat(samSelector.getAtrFilter().getAtrRegex()) .isEqualTo("3B(.{6}|.{10})805A..80C120.{4}11223344829000"); }
@Test(expected = IllegalArgumentException.class) public void test_UnlockData_badLength() { final String UNLOCK_DATA_BAD_LENGTH = "00112233445566778899AABBCCDDEEFF00"; SamSelector samSelector = SamSelector.builder() .samIdentifier( new SamIdentifier.SamIdentifierBuilder() .samRevision(SamRevision.C1) .serialNumber("11223344") .build()) .unlockData(ByteArrayUtil.fromHex(UNLOCK_DATA_BAD_LENGTH)) .build(); }