ChipSystemPinCommand implements PinCommand { @Override public boolean read(Pin pin) throws PinCommandException { try { String result = RuntimeCommandExec.exec(Commands.READ.command(pin)); switch (result) { case "1": return true; case "0": return false; default: throw new PinCommandException("Pin value is invalid :" + result); } } 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 testRead() throws Exception { try { ChipSystemPinCommand cmd = new ChipSystemPinCommand(); cmd.read(getPin()); assert true; } catch (PinCommandException e) { dealWithException(e); } }