### Question:
AndroidNfcReader extends AbstractSelectionLocalReader implements NfcAdapter.ReaderCallback { int getFlags() { int flags = 0; String ndef = parameters.get(AndroidNfcReader.FLAG_READER_SKIP_NDEF_CHECK); String nosounds = parameters.get(AndroidNfcReader.FLAG_READER_NO_PLATFORM_SOUNDS); if (ndef != null && ndef.equals("1")) { flags = flags | NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK; } if (nosounds != null && nosounds.equals("1")) { flags = flags | NfcAdapter.FLAG_READER_NO_PLATFORM_SOUNDS; } for (SeProtocol seProtocol : this.protocolsMap.keySet()) { if (ContactlessProtocols.PROTOCOL_ISO14443_4 == seProtocol) { flags = flags | NfcAdapter.FLAG_READER_NFC_B | NfcAdapter.FLAG_READER_NFC_A; } else if (seProtocol == ContactlessProtocols.PROTOCOL_MIFARE_UL || seProtocol == ContactlessProtocols.PROTOCOL_MIFARE_CLASSIC) { flags = flags | NfcAdapter.FLAG_READER_NFC_A; } } return flags; } AndroidNfcReader(); Map<String, String> getParameters(); @Override void setParameter(String key, String value); @Override TransmissionMode getTransmissionMode(); @Override void onTagDiscovered(Tag tag); String printTagId(); static final String FLAG_READER_SKIP_NDEF_CHECK; static final String FLAG_READER_NO_PLATFORM_SOUNDS; static final String FLAG_READER_PRESENCE_CHECK_DELAY; }### Answer:
@Test public void setIsoDepProtocol() { reader.addSeProtocolSetting( new SeProtocolSetting(AndroidNfcProtocolSettings.SETTING_PROTOCOL_ISO14443_4)); assertEquals(NfcAdapter.FLAG_READER_NFC_B | NfcAdapter.FLAG_READER_NFC_A, reader.getFlags()); }
@Test public void setMifareProtocol() { reader.addSeProtocolSetting( new SeProtocolSetting(AndroidNfcProtocolSettings.SETTING_PROTOCOL_MIFARE_CLASSIC)); assertEquals(NfcAdapter.FLAG_READER_NFC_A, reader.getFlags()); }
@Test public void setMifareULProtocol() { reader.addSeProtocolSetting( new SeProtocolSetting(AndroidNfcProtocolSettings.SETTING_PROTOCOL_MIFARE_UL)); assertEquals(NfcAdapter.FLAG_READER_NFC_A, reader.getFlags()); }