### Question:
AndroidNfcReader extends AbstractSelectionLocalReader implements NfcAdapter.ReaderCallback { @Override protected void closePhysicalChannel() throws KeypleChannelStateException { try { if (tagProxy != null) { tagProxy.close(); notifyObservers(new ReaderEvent(PLUGIN_NAME, READER_NAME, ReaderEvent.EventType.SE_REMOVAL, null)); LOG.info("Disconnected tag : " + printTagId()); } } catch (IOException e) { LOG.error("Disconnecting error"); throw new KeypleChannelStateException("Error while closing physical channel", e); } tagProxy = null; } 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(expected = KeypleReaderException.class) public void closePhysicalChannelError() throws KeypleBaseException, IOException { insertSe(); when(tagProxy.isConnected()).thenReturn(true); doThrow(new IOException()).when(tagProxy).close(); reader.closePhysicalChannel(); }
@Test public void closePhysicalChannelSuccess() throws KeypleReaderException { insertSe(); when(tagProxy.isConnected()).thenReturn(true); reader.closePhysicalChannel(); }