Mad1 extends AbstractMad { protected void updateCrc() { if (isReadonly()) throw new IllegalStateException("cannot modify readonly mad"); madData[0] = createCrc(madData); } Mad1(MfClassicReaderWriter readerWriter, MadKeyConfig keyConfig);   Mad1(MfClassicReaderWriter readerWriter, MadKeyConfig keyConfig, TrailerBlock trailerBlock); void initMadTrailer(int madVersion); @Override void readMad(); @Override void writeMad(); @Override void makeReadOnly(); @Override int getGeneralPurposeByte(); @Override int getInfoByte(); @Override int getMaxContinousSize(); @Override int getVersion(); @Override boolean isFree(int aidSlot); @Override int getNumberOfSlots();  }
@Test public void testMadCrc() throws Exception { MfClassicReaderWriter readerWriter = loadData(cardWithMad); Mad1 applicationDirectory = (Mad1)readerWriter.getApplicationDirectory(MAD_KEY_CONFIG); applicationDirectory.updateCrc(); assertEquals((byte)0xf3, applicationDirectory.madData[0]); }