@Test public void setBrightness_throwsIfTooSmall() throws IOException { Apa102 leds = new Apa102(mSpiDevice, Apa102.Mode.BGR, Apa102.Direction.NORMAL); mExpectedException.expect(IllegalArgumentException.class); leds.setBrightness(-1); }
public void setBrightness(int ledBrightness) { if (ledBrightness < 0 || ledBrightness > MAX_BRIGHTNESS) { throw new IllegalArgumentException("Brightness needs to be between 0 and " + MAX_BRIGHTNESS); } mLedBrightness = ledBrightness; }
Apa102 implements AutoCloseable { public void setBrightness(int ledBrightness) { if (ledBrightness < 0 || ledBrightness > MAX_BRIGHTNESS) { throw new IllegalArgumentException("Brightness needs to be between 0 and " + MAX_BRIGHTNESS); } mLedBrightness = ledBrightness; } }
Apa102 implements AutoCloseable { public void setBrightness(int ledBrightness) { if (ledBrightness < 0 || ledBrightness > MAX_BRIGHTNESS) { throw new IllegalArgumentException("Brightness needs to be between 0 and " + MAX_BRIGHTNESS); } mLedBrightness = ledBrightness; } Apa102(String spiBusPort, Mode ledMode);  Apa102(String spiBusPort, Mode ledMode, Direction direction);  Apa102(String spiBusPort, Mode ledMode, Direction direction, int spiMode); @VisibleForTesting  Apa102(SpiDevice device, Mode ledMode, Direction direction); }
Apa102 implements AutoCloseable { public void setBrightness(int ledBrightness) { if (ledBrightness < 0 || ledBrightness > MAX_BRIGHTNESS) { throw new IllegalArgumentException("Brightness needs to be between 0 and " + MAX_BRIGHTNESS); } mLedBrightness = ledBrightness; } Apa102(String spiBusPort, Mode ledMode);  Apa102(String spiBusPort, Mode ledMode, Direction direction);  Apa102(String spiBusPort, Mode ledMode, Direction direction, int spiMode); @VisibleForTesting  Apa102(SpiDevice device, Mode ledMode, Direction direction); void setBrightness(int ledBrightness); int getBrightness(); void setDirection(Direction direction); Direction getDirection(); void write(int[] colors); @Override void close(); }
Apa102 implements AutoCloseable { public void setBrightness(int ledBrightness) { if (ledBrightness < 0 || ledBrightness > MAX_BRIGHTNESS) { throw new IllegalArgumentException("Brightness needs to be between 0 and " + MAX_BRIGHTNESS); } mLedBrightness = ledBrightness; } Apa102(String spiBusPort, Mode ledMode);  Apa102(String spiBusPort, Mode ledMode, Direction direction);  Apa102(String spiBusPort, Mode ledMode, Direction direction, int spiMode); @VisibleForTesting  Apa102(SpiDevice device, Mode ledMode, Direction direction); void setBrightness(int ledBrightness); int getBrightness(); void setDirection(Direction direction); Direction getDirection(); void write(int[] colors); @Override void close(); static final int MAX_BRIGHTNESS; }