@Test public void say_パラメータ未指定の場合はエラー() { try { _s.say(null); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("param is null.")); } VoiceParameter param = new VoiceParameter(); try { _s.say(param); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("param.text is blank.")); } param = new VoiceParameter(); param.setText(""); try { _s.say(param); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("param.text is blank.")); } param = new VoiceParameter(); param.setText(" "); try { _s.say(param); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("param.text is blank.")); } }
public byte[] say(VoiceParameter param) { L.debug("#say: param=" + param); if (param == null) { throw new IllegalArgumentException("param is null."); } if (StringUtils.isBlank(param.getText())) { throw new IllegalArgumentException("param.text is blank."); } param.setText(param.getText().trim()); byte[] voiceData = _openJTalkRepo.createVoice(param); L.debug("voiceData.length=" + voiceData.length); return voiceData; }
VoiceService { public byte[] say(VoiceParameter param) { L.debug("#say: param=" + param); if (param == null) { throw new IllegalArgumentException("param is null."); } if (StringUtils.isBlank(param.getText())) { throw new IllegalArgumentException("param.text is blank."); } param.setText(param.getText().trim()); byte[] voiceData = _openJTalkRepo.createVoice(param); L.debug("voiceData.length=" + voiceData.length); return voiceData; } }
VoiceService { public byte[] say(VoiceParameter param) { L.debug("#say: param=" + param); if (param == null) { throw new IllegalArgumentException("param is null."); } if (StringUtils.isBlank(param.getText())) { throw new IllegalArgumentException("param.text is blank."); } param.setText(param.getText().trim()); byte[] voiceData = _openJTalkRepo.createVoice(param); L.debug("voiceData.length=" + voiceData.length); return voiceData; }  }
VoiceService { public byte[] say(VoiceParameter param) { L.debug("#say: param=" + param); if (param == null) { throw new IllegalArgumentException("param is null."); } if (StringUtils.isBlank(param.getText())) { throw new IllegalArgumentException("param.text is blank."); } param.setText(param.getText().trim()); byte[] voiceData = _openJTalkRepo.createVoice(param); L.debug("voiceData.length=" + voiceData.length); return voiceData; }  byte[] say(VoiceParameter param); }
VoiceService { public byte[] say(VoiceParameter param) { L.debug("#say: param=" + param); if (param == null) { throw new IllegalArgumentException("param is null."); } if (StringUtils.isBlank(param.getText())) { throw new IllegalArgumentException("param.text is blank."); } param.setText(param.getText().trim()); byte[] voiceData = _openJTalkRepo.createVoice(param); L.debug("voiceData.length=" + voiceData.length); return voiceData; }  byte[] say(VoiceParameter param);  }