@Test public void testRequestTurnOnInvalid() { assertThat(captureThrowable(() -> requestTurnOn(null))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid integer format"); assertThat(captureThrowable(() -> requestTurnOn(""))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid integer format"); assertThat(captureThrowable(() -> requestTurnOn("a1"))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid integer format"); assertThat(captureThrowable(() -> requestTurnOn("-1"))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("value must be between 0 and 9999"); assertThat(captureThrowable(() -> requestTurnOn("10000"))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("value must be between 0 and 9999"); }
public static Lighting requestTurnOn(String where) { checkRange(WHERE_MIN_VALUE, WHERE_MAX_VALUE, checkIsInteger(where)); return new Lighting(format(FORMAT_REQUEST, WHO, ON, where)); }
Lighting extends BaseOpenMessage { public static Lighting requestTurnOn(String where) { checkRange(WHERE_MIN_VALUE, WHERE_MAX_VALUE, checkIsInteger(where)); return new Lighting(format(FORMAT_REQUEST, WHO, ON, where)); } }
Lighting extends BaseOpenMessage { public static Lighting requestTurnOn(String where) { checkRange(WHERE_MIN_VALUE, WHERE_MAX_VALUE, checkIsInteger(where)); return new Lighting(format(FORMAT_REQUEST, WHO, ON, where)); } private  Lighting(String value); }
Lighting extends BaseOpenMessage { public static Lighting requestTurnOn(String where) { checkRange(WHERE_MIN_VALUE, WHERE_MAX_VALUE, checkIsInteger(where)); return new Lighting(format(FORMAT_REQUEST, WHO, ON, where)); } private  Lighting(String value); static Lighting requestTurnOn(String where); static Lighting requestTurnOn(String where, Type type, String bus); static Lighting requestTurnOff(String where); static Lighting requestTurnOff(String where, Type type, String bus); static Func1<OpenSession, OpenSession> handleResponse(Action0 onSuccess, Action0 onFail); static Lighting requestStatus(String where); static Lighting requestStatus(String where, Type type, String bus); static Func1<OpenSession, OpenSession> handleStatus(Action0 onStatus, Action0 offStatus); static boolean isValidRangeType(String where, Type type, String bus); }
Lighting extends BaseOpenMessage { public static Lighting requestTurnOn(String where) { checkRange(WHERE_MIN_VALUE, WHERE_MAX_VALUE, checkIsInteger(where)); return new Lighting(format(FORMAT_REQUEST, WHO, ON, where)); } private  Lighting(String value); static Lighting requestTurnOn(String where); static Lighting requestTurnOn(String where, Type type, String bus); static Lighting requestTurnOff(String where); static Lighting requestTurnOff(String where, Type type, String bus); static Func1<OpenSession, OpenSession> handleResponse(Action0 onSuccess, Action0 onFail); static Lighting requestStatus(String where); static Lighting requestStatus(String where, Type type, String bus); static Func1<OpenSession, OpenSession> handleStatus(Action0 onStatus, Action0 offStatus); static boolean isValidRangeType(String where, Type type, String bus);  }