ChipSystemPinCommand implements PinCommand { @Override public void setMode(Pin pin, Pin.Mode mode) throws PinCommandException { try { switch (mode) { case IN: RuntimeCommandExec.exec(Commands.SET_MODE_IN.command(pin)); break; case OUT: RuntimeCommandExec.exec(Commands.SET_MODE_OUT.command(pin)); break; default: throw new PinCommandException("System command is missing for mode " + mode.name()); } return; } catch (RuntimeCommandException e) { throw new PinCommandException(e); } }  @Override Pin.Mode getMode(Pin pin); @Override void setMode(Pin pin, Pin.Mode mode); @Override void enable(Pin pin); @Override void disable(Pin pin); @Override boolean read(Pin pin); @Override void write(Pin pin, boolean value); @Override File path(Pin pin); static void led(boolean on);  }
@Test public void testSetMode() throws Exception { try { ChipSystemPinCommand cmd = new ChipSystemPinCommand(); cmd.setMode(getPin(), Pin.Mode.IN); assert true; } catch (PinCommandException e) { dealWithException(e); } }