### Question:
SpotifySpeech { @Intent() public String control(Map<String, EntityData> entites) { switch (entites.get("type").getString()) { case "back": this.playerLogic.back(); break; case "skip": this.playerLogic.skip(); break; case "pause": case "pass": case "stop": this.playerLogic.pause(); break; case "resume": this.playerLogic.resume(); break; default: return ERROR_MESSAGE; } return "OK"; }  @Intent() String getDevices(Map<String, EntityData> entites); @Intent() Response getCurrentSong(Map<String, EntityData> entites); @Intent() String getPlaylists(Map<String, EntityData> entites); @Intent() String playSomething(Map<String, EntityData> entites); @Intent() String control(Map<String, EntityData> entites); @Intent() String volume(Map<String, EntityData> entites); @Intent() String volumePercent(Map<String, EntityData> entites); @Intent() String setDeviceId(Map<String, EntityData> entites); @Intent() String setDeviceName(Map<String, EntityData> entites); @Intent() String playPlaylistId(Map<String, EntityData> entites); @Intent() Response searchASong(Map<String, EntityData> entites); @EntityProvider("devicename") List<String> getDeviceNames();  }### Answer:
@Test void testControlErr() { Map<String, EntityData> map = new HashMap<>(); map.put("type", this.entityData); when(this.entityData.getString()).thenReturn("back"); this.speech.control(map); verify(this.playerlogic).back(); when(this.entityData.getString()).thenReturn("skip"); this.speech.control(map); verify(this.playerlogic).skip(); when(this.entityData.getString()).thenReturn("pause"); this.speech.control(map); verify(this.playerlogic).pause(); when(this.entityData.getString()).thenReturn("resume"); this.speech.control(map); verify(this.playerlogic).resume(); when(this.entityData.getString()).thenReturn("bla"); assertThat(this.speech.control(map), equalTo("An error occurred")); }
@Test void testControl() { Map<String, EntityData> map = new HashMap<>(); map.put("type", this.entityData); when(this.playerlogic.back()).thenReturn(true); when(this.entityData.getString()).thenReturn("back"); this.speech.control(map); when(this.entityData.getString()).thenReturn("skip"); when(this.playerlogic.skip()).thenReturn(true); this.speech.control(map); when(this.entityData.getString()).thenReturn("pause"); when(this.playerlogic.pause()).thenReturn(true); this.speech.control(map); when(this.entityData.getString()).thenReturn("resume"); when(this.playerlogic.resume()).thenReturn(true); this.speech.control(map); when(this.entityData.getString()).thenReturn("bla"); assertThat(this.speech.control(map), equalTo("An error occurred")); }