@Test public void setValue_WithValidParams() throws Exception { mAction = new PwmPeriodAction(mService, 2, 5000000, 3); mAction.setValue(); verify(mCharacteristic, times(1)).setValue(mValueCaptor.capture()); assertThat(mValueCaptor.getValue()) .isEqualTo(new byte[] {(byte) 0x02, (byte) 0x00, (byte) 0x4c, (byte) 0x4b, (byte) 0x40}); }
@Test public void hasValidParams_WithValidModes() throws Exception { mAction = new PwmPeriodAction(mService, 2, 4, 3); assertThat(mAction.validate()).isEqualTo(KonashiErrorType.NO_ERROR); }
@Test public void hasValidParams_WithInvalidModes() throws Exception { mAction = new PwmPeriodAction(mService, 2, 3, 4); assertThat(mAction.validate()).isEqualTo(KonashiErrorType.INVALID_MODE); }