@Test public void testParseTrack2ThrowsInvalidCardException1() throws Throwable { CardHolder cardHolder = new CardHolder(); assertThrows(InvalidCardException.class, () -> cardHolder.parseTrack2("testCardHolders")); assertNull(cardHolder.exp, "cardHolder.exp"); assertNull(cardHolder.pan, "cardHolder.pan"); assertNull(cardHolder.trailer, "cardHolder.trailler"); }
public void parseTrack2 (String s) throws InvalidCardException { if (s == null) throw new InvalidCardException ("null track2 data"); int separatorIndex = s.replace ('D','=').indexOf(TRACK2_SEPARATOR); if (separatorIndex > 0 && s.length() > separatorIndex+4) { pan = s.substring(0, separatorIndex); exp = s.substring(separatorIndex+1, separatorIndex+1+4); trailer = s.substring(separatorIndex+1+4); } else throw new InvalidCardException ("Invalid track2 format"); }
CardHolder implements Cloneable, Serializable, Loggeable { public void parseTrack2 (String s) throws InvalidCardException { if (s == null) throw new InvalidCardException ("null track2 data"); int separatorIndex = s.replace ('D','=').indexOf(TRACK2_SEPARATOR); if (separatorIndex > 0 && s.length() > separatorIndex+4) { pan = s.substring(0, separatorIndex); exp = s.substring(separatorIndex+1, separatorIndex+1+4); trailer = s.substring(separatorIndex+1+4); } else throw new InvalidCardException ("Invalid track2 format"); } }
CardHolder implements Cloneable, Serializable, Loggeable { public void parseTrack2 (String s) throws InvalidCardException { if (s == null) throw new InvalidCardException ("null track2 data"); int separatorIndex = s.replace ('D','=').indexOf(TRACK2_SEPARATOR); if (separatorIndex > 0 && s.length() > separatorIndex+4) { pan = s.substring(0, separatorIndex); exp = s.substring(separatorIndex+1, separatorIndex+1+4); trailer = s.substring(separatorIndex+1+4); } else throw new InvalidCardException ("Invalid track2 format"); } CardHolder();  CardHolder(String track2);  CardHolder(String pan, String exp);  CardHolder(ISOMsg m); }
CardHolder implements Cloneable, Serializable, Loggeable { public void parseTrack2 (String s) throws InvalidCardException { if (s == null) throw new InvalidCardException ("null track2 data"); int separatorIndex = s.replace ('D','=').indexOf(TRACK2_SEPARATOR); if (separatorIndex > 0 && s.length() > separatorIndex+4) { pan = s.substring(0, separatorIndex); exp = s.substring(separatorIndex+1, separatorIndex+1+4); trailer = s.substring(separatorIndex+1+4); } else throw new InvalidCardException ("Invalid track2 format"); } CardHolder();  CardHolder(String track2);  CardHolder(String pan, String exp);  CardHolder(ISOMsg m); void parseTrack2(String s); void setTrack1(String track1); String getTrack1(); boolean hasTrack1(); String getNameOnCard(); String getTrack2(); boolean hasTrack2(); void setSecurityCode(String securityCode); String getSecurityCode(); boolean hasSecurityCode(); @SuppressWarnings("unused") String getTrailler(); @SuppressWarnings("unused") void setTrailler(String trailer); String getTrailer(); void setTrailer(String trailer); void setPAN(String pan); String getPAN(); String getBIN(); void setEXP(String exp); String getEXP(); boolean isExpired(); boolean isExpired(Date currentDate); boolean isValidCRC(); static boolean isValidCRC(String p); void dump(PrintStream p, String indent); String getServiceCode(); boolean seemsManualEntry(); @Override int hashCode(); @Override boolean equals(Object obj); }
CardHolder implements Cloneable, Serializable, Loggeable { public void parseTrack2 (String s) throws InvalidCardException { if (s == null) throw new InvalidCardException ("null track2 data"); int separatorIndex = s.replace ('D','=').indexOf(TRACK2_SEPARATOR); if (separatorIndex > 0 && s.length() > separatorIndex+4) { pan = s.substring(0, separatorIndex); exp = s.substring(separatorIndex+1, separatorIndex+1+4); trailer = s.substring(separatorIndex+1+4); } else throw new InvalidCardException ("Invalid track2 format"); } CardHolder();  CardHolder(String track2);  CardHolder(String pan, String exp);  CardHolder(ISOMsg m); void parseTrack2(String s); void setTrack1(String track1); String getTrack1(); boolean hasTrack1(); String getNameOnCard(); String getTrack2(); boolean hasTrack2(); void setSecurityCode(String securityCode); String getSecurityCode(); boolean hasSecurityCode(); @SuppressWarnings("unused") String getTrailler(); @SuppressWarnings("unused") void setTrailler(String trailer); String getTrailer(); void setTrailer(String trailer); void setPAN(String pan); String getPAN(); String getBIN(); void setEXP(String exp); String getEXP(); boolean isExpired(); boolean isExpired(Date currentDate); boolean isValidCRC(); static boolean isValidCRC(String p); void dump(PrintStream p, String indent); String getServiceCode(); boolean seemsManualEntry(); @Override int hashCode(); @Override boolean equals(Object obj);  }