SeSelection { public SelectionsResult processDefaultSelection( AbstractDefaultSelectionsResponse defaultSelectionsResponse) { if (defaultSelectionsResponse == null) { logger.error("defaultSelectionsResponse shouldn't be null in processSelection."); return null; } if (logger.isTraceEnabled()) { logger.trace( "Process default SELECTIONRESPONSE ({} response(s))", ((DefaultSelectionsResponse) defaultSelectionsResponse).getSelectionSeResponses().size()); } return processSelection(defaultSelectionsResponse); } SeSelection(MultiSeRequestProcessing multiSeRequestProcessing);  SeSelection(); int prepareSelection(
      AbstractSeSelectionRequest<? extends AbstractApduCommandBuilder> seSelectionRequest); final void prepareReleaseSeChannel(); SelectionsResult processDefaultSelection(
      AbstractDefaultSelectionsResponse defaultSelectionsResponse); SelectionsResult processExplicitSelection(SeReader seReader); AbstractDefaultSelectionsRequest getSelectionOperation();  }
@Test public void processDefaultSelectionNull() { SeSelection seSelection = Mockito.mock(SeSelection.class); try { Assert.assertNull(seSelection.processDefaultSelection(null)); } catch (KeypleException e) { Assert.fail("Exception raised: " + e.getMessage()); } }
@Test public void processDefaultSelectionEmpty() { SeSelection seSelection = createSeSelection(); AbstractDefaultSelectionsResponse defaultSelectionsResponse; List<SeResponse> seResponses = new ArrayList<SeResponse>(); defaultSelectionsResponse = new DefaultSelectionsResponse(seResponses); SelectionsResult selectionsResult = null; try { selectionsResult = seSelection.processDefaultSelection(defaultSelectionsResponse); } catch (KeypleException e) { Assert.fail("Exception raised: " + e.getMessage()); } Assert.assertFalse(selectionsResult.hasActiveSelection()); Assert.assertEquals(0, selectionsResult.getMatchingSelections().size()); }
@Test public void processDefaultSelectionNotMatching() { SeSelection seSelection = createSeSelection(); AbstractDefaultSelectionsResponse defaultSelectionsResponse; List<SeResponse> seResponses = new ArrayList<SeResponse>(); ApduResponse apduResponse = new ApduResponse( ByteArrayUtil.fromHex( "CC 11223344 9999 00112233445566778899AABBCCDDEEFF 00112233445566778899AABBCC 9000"), null); List<ApduResponse> apduResponses = new ArrayList<ApduResponse>(); apduResponses.add(apduResponse); SelectionStatus selectionStatus = new SelectionStatus( null, new ApduResponse(ByteArrayUtil.fromHex("001122334455669000"), null), false); SeResponse seResponse = new SeResponse(true, true, selectionStatus, apduResponses); seResponses.add(seResponse); defaultSelectionsResponse = new DefaultSelectionsResponse(seResponses); SelectionsResult selectionsResult = null; try { selectionsResult = seSelection.processDefaultSelection(defaultSelectionsResponse); } catch (KeypleException e) { Assert.fail("Exception raised: " + e.getMessage()); } Assert.assertFalse(selectionsResult.hasActiveSelection()); try { selectionsResult.getActiveMatchingSe(); } catch (Exception e) { Assert.assertTrue(e.getMessage().contains("No active Matching SE is available")); } }
@Test public void processDefaultSelectionMatching() { SeSelection seSelection = createSeSelection(); AbstractDefaultSelectionsResponse defaultSelectionsResponse; List<SeResponse> seResponses = new ArrayList<SeResponse>(); ApduResponse apduResponse = new ApduResponse( ByteArrayUtil.fromHex( "CC 11223344 9999 00112233445566778899AABBCCDDEEFF 00112233445566778899AABBCC 9000"), null); List<ApduResponse> apduResponses = new ArrayList<ApduResponse>(); apduResponses.add(apduResponse); SelectionStatus selectionStatus = new SelectionStatus( null, new ApduResponse(ByteArrayUtil.fromHex("001122334455669000"), null), true); SeResponse seResponse = new SeResponse(true, true, selectionStatus, apduResponses); seResponses.add(seResponse); defaultSelectionsResponse = new DefaultSelectionsResponse(seResponses); SelectionsResult selectionsResult = null; try { selectionsResult = seSelection.processDefaultSelection(defaultSelectionsResponse); } catch (KeypleException e) { Assert.fail("Exception raised: " + e.getMessage()); } Assert.assertTrue(selectionsResult.hasActiveSelection()); Assert.assertNotNull(selectionsResult.getActiveMatchingSe()); }