  @Test
  public void setAllPwm() throws Exception {

    when(peripheralManagerServiceMock.getI2cBusList()).thenReturn(i2cDevices);
    when(peripheralManagerServiceMock.openI2cDevice("I2C1",0x40)).thenReturn(i2cDeviceMock);

    when(i2cDeviceMock.readRegByte(MODE1)).thenReturn((byte)0x0);

    PCA9685 device = new PCA9685((byte)0x40, peripheralManagerServiceMock);

    InOrder inOrder = inOrder(i2cDeviceMock);

    device.setAllPwm(10,20);

    inOrder.verify(i2cDeviceMock).writeRegByte(ALL_LED_ON_L ,(byte) (10 & 0xff));
    inOrder.verify(i2cDeviceMock).writeRegByte(ALL_LED_ON_H ,(byte) (10 >> 8));
    inOrder.verify(i2cDeviceMock).writeRegByte(ALL_LED_OFF_L, (byte) (20 & 0xff));
    inOrder.verify(i2cDeviceMock).writeRegByte(ALL_LED_OFF_H, (byte) (20 >> 8));

    device.setAllPwm(1000,2123);

    inOrder.verify(i2cDeviceMock).writeRegByte(ALL_LED_ON_L ,(byte) (1000 & 0xff));
    inOrder.verify(i2cDeviceMock).writeRegByte(ALL_LED_ON_H ,(byte) (1000 >> 8));
    inOrder.verify(i2cDeviceMock).writeRegByte(ALL_LED_OFF_L, (byte) (2123 & 0xff));
    inOrder.verify(i2cDeviceMock).writeRegByte(ALL_LED_OFF_H, (byte) (2123 >> 8));

    inOrder.verifyNoMoreInteractions();

  }