@Test public void close_safeToCallTwice() throws IOException { Tm1637 tm1637 = new Tm1637(mDevice); tm1637.close(); tm1637.close(); Mockito.verify(mDevice, times(1)).close(); }
@Override public void close() throws IOException { if (mDevice != null) { try { mDevice.close(); } finally { mDevice = null; } } }
Tm1637 implements Closeable { @Override public void close() throws IOException { if (mDevice != null) { try { mDevice.close(); } finally { mDevice = null; } } } }
Tm1637 implements Closeable { @Override public void close() throws IOException { if (mDevice != null) { try { mDevice.close(); } finally { mDevice = null; } } } Tm1637(String dataPin, String clockPin); @VisibleForTesting  Tm1637(I2cBitBangDevice device); }
Tm1637 implements Closeable { @Override public void close() throws IOException { if (mDevice != null) { try { mDevice.close(); } finally { mDevice = null; } } } Tm1637(String dataPin, String clockPin); @VisibleForTesting  Tm1637(I2cBitBangDevice device); @Override void close(); void setBrightness(int value); void setBrightness(float value); void writeData(byte[] data); }
Tm1637 implements Closeable { @Override public void close() throws IOException { if (mDevice != null) { try { mDevice.close(); } finally { mDevice = null; } } } Tm1637(String dataPin, String clockPin); @VisibleForTesting  Tm1637(I2cBitBangDevice device); @Override void close(); void setBrightness(int value); void setBrightness(float value); void writeData(byte[] data); static final int MAX_BRIGHTNESS; static final int MAX_DATA_LENGTH; }