SoundSystem extends BaseOpenMessage { public static SoundSystem requestTurnOn(String where, Type type, Source source) { return buildRequest(where, type, source, ON_SOURCE_BASE_BAND, ON_SOURCE_STEREO_CHANNEL); } protected  SoundSystem(String value); static SoundSystem requestTurnOn(String where, Type type, Source source); static SoundSystem requestTurnOff(String where, Type type, Source source); static Func1<OpenSession, OpenSession> handleResponse(Action0 onSuccess, Action0 onFail); static SoundSystem requestStatus(String where, Type type); static Func1<OpenSession, OpenSession> handleStatus(Action0 onStatus, Action0 offStatus); static SoundSystem requestVolumeUp(String where, Type type); static SoundSystem requestVolumeDown(String where, Type type); static SoundSystem requestStationUp(String where, Type type); static SoundSystem requestStationDown(String where, Type type);  }
@Test public void testRequestTurnOn() { assertEquals("invalid message", "*16*3*0##", requestTurnOn("0", Type.AMPLIFIER_GENERAL, Source.STEREO_CHANNEL).getValue()); assertEquals("invalid message", "*16*0*0##", requestTurnOn("0", Type.AMPLIFIER_GENERAL, Source.BASE_BAND).getValue()); assertEquals("invalid message", "*16*3*#0##", requestTurnOn("0", Type.AMPLIFIER_GROUP, Source.STEREO_CHANNEL).getValue()); assertEquals("invalid message", "*16*3*#9##", requestTurnOn("9", Type.AMPLIFIER_GROUP, Source.STEREO_CHANNEL).getValue()); assertEquals("invalid message", "*16*0*#0##", requestTurnOn("0", Type.AMPLIFIER_GROUP, Source.BASE_BAND).getValue()); assertEquals("invalid message", "*16*0*#9##", requestTurnOn("9", Type.AMPLIFIER_GROUP, Source.BASE_BAND).getValue()); assertEquals("invalid message", "*16*3*01##", requestTurnOn("01", Type.AMPLIFIER_P2P, Source.STEREO_CHANNEL).getValue()); assertEquals("invalid message", "*16*3*09##", requestTurnOn("09", Type.AMPLIFIER_P2P, Source.STEREO_CHANNEL).getValue()); assertEquals("invalid message", "*16*3*99##", requestTurnOn("99", Type.AMPLIFIER_P2P, Source.STEREO_CHANNEL).getValue()); assertEquals("invalid message", "*16*0*01##", requestTurnOn("01", Type.AMPLIFIER_P2P, Source.BASE_BAND).getValue()); assertEquals("invalid message", "*16*0*09##", requestTurnOn("09", Type.AMPLIFIER_P2P, Source.BASE_BAND).getValue()); assertEquals("invalid message", "*16*0*99##", requestTurnOn("99", Type.AMPLIFIER_P2P, Source.BASE_BAND).getValue()); assertEquals("invalid message", "*16*3*100##", requestTurnOn("100", Type.SOURCE_GENERAL, Source.STEREO_CHANNEL).getValue()); assertEquals("invalid message", "*16*0*100##", requestTurnOn("100", Type.SOURCE_GENERAL, Source.BASE_BAND).getValue()); assertEquals("invalid message", "*16*3*101##", requestTurnOn("101", Type.SOURCE_P2P, Source.STEREO_CHANNEL).getValue()); assertEquals("invalid message", "*16*3*109##", requestTurnOn("109", Type.SOURCE_P2P, Source.STEREO_CHANNEL).getValue()); assertEquals("invalid message", "*16*0*101##", requestTurnOn("101", Type.SOURCE_P2P, Source.BASE_BAND).getValue()); assertEquals("invalid message", "*16*0*109##", requestTurnOn("109", Type.SOURCE_P2P, Source.BASE_BAND).getValue()); }
@Test public void testRequestTurnOnInvalid() { assertThat(captureThrowable(() -> requestTurnOn(null, null, null))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("", Type.AMPLIFIER_P2P, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("a", Type.AMPLIFIER_P2P, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("1", null, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("1", Type.AMPLIFIER_P2P, null))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); }
@Test public void testRequestTurnOnInvalid_AmplifierGeneral() { assertThat(captureThrowable(() -> requestTurnOn("-1", Type.AMPLIFIER_GENERAL, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("1", Type.AMPLIFIER_GENERAL, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("a", Type.AMPLIFIER_GROUP, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid integer format"); }
@Test public void testRequestTurnOnInvalid_AmplifierGroup() { assertThat(captureThrowable(() -> requestTurnOn("00", Type.AMPLIFIER_GROUP, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("01", Type.AMPLIFIER_GROUP, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("09", Type.AMPLIFIER_GROUP, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("10", Type.AMPLIFIER_GROUP, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("#1", Type.AMPLIFIER_GROUP, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("#", Type.AMPLIFIER_GROUP, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid integer format"); }
@Test public void testRequestTurnOnInvalid_AmplifierP2P() { assertThat(captureThrowable(() -> requestTurnOn("1", Type.AMPLIFIER_P2P, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("9", Type.AMPLIFIER_P2P, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("100", Type.AMPLIFIER_P2P, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("001", Type.AMPLIFIER_P2P, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); }
@Test public void testRequestTurnOnInvalid_SourceGeneral() { assertThat(captureThrowable(() -> requestTurnOn("0100", Type.SOURCE_GENERAL, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("99", Type.SOURCE_GENERAL, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("101", Type.SOURCE_GENERAL, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); }
@Test public void testRequestTurnOnInvalid_SourceP2P() { assertThat(captureThrowable(() -> requestTurnOn("100", Type.SOURCE_P2P, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("110", Type.SOURCE_P2P, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); assertThat(captureThrowable(() -> requestTurnOn("0101", Type.SOURCE_P2P, Source.STEREO_CHANNEL))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("invalid where|type"); }