### Question:
AbstractPinProvider implements PinProvider { public Pin getPinByAlias(String alias) { if(alias == null) { throw new IllegalArgumentException("Null may not be passed as an alias name for a pin."); } for(Pin pin : getPins()) { if(alias.equals(pin.getAlias())) { 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 testGetPinByAlias() { MockedBoard board = new MockedBoard(); for(int i = 0; i < aliases.length; i++) { board.getPins().get(i).setAlias(aliases[i]); } Pin availablePin = board.getPinByAlias(aliases[4]); TestCase.assertNotNull(availablePin); TestCase.assertEquals(aliases[4], availablePin.getAlias()); Pin nonExistentPin = board.getPinByAlias("LALALALALA"); TestCase.assertNull(nonExistentPin); nonExistentPin = board.getPinByAlias("Greedo"); TestCase.assertNull(nonExistentPin); for(Pin pin : board.getPins()) { if(pin.getAlias() != null) { Pin crossCheck = board.getPinByAlias(pin.getAlias()); TestCase.assertSame(pin, crossCheck); } else { try { board.getPinByAlias(pin.getAlias()); TestCase.fail(); } catch(IllegalArgumentException ex) {} } } try { board.getPinByAlias(null); TestCase.fail(); } catch(IllegalArgumentException ex) {} }