### Question:
AbstractPinProvider implements PinProvider { public Pin getPin(int address) { for(Pin pin : getPins()) { if(pin.getAddress() == address) { return pin; } } return null; }  List<Pin> getPins(); Pin getPin(int address); Pin getPin(String port, int index); Pin getPin(String name); Pin getPinByAlias(String alias);  }### Answer:
@Test public void testGetPin() { MockedBoard board = new MockedBoard(); Pin availablePin = board.getPin("A", 1); TestCase.assertNotNull(availablePin); TestCase.assertEquals("A", availablePin.getPort()); TestCase.assertEquals(1, availablePin.getIndexOnPort()); Pin nonExistentPin = board.getPin("A", 11); TestCase.assertNull(nonExistentPin); nonExistentPin = board.getPin("Chewbacca", 1); TestCase.assertNull(nonExistentPin); for(Pin pin : board.getPins()) { Pin crossCheck = board.getPin(pin.getPort(), pin.getIndexOnPort()); TestCase.assertSame(pin, crossCheck); } try { board.getPin(null, 2); TestCase.fail(); } catch(IllegalArgumentException ex) {} try { board.getPin(null, -1); TestCase.fail(); } catch(IllegalArgumentException ex) {} try { board.getPin("A", -1); TestCase.fail(); } catch(IllegalArgumentException ex) {} }