### Question:
SpotifySpeech { @Intent() public Response searchASong(Map<String, EntityData> entites) { switch (entites.get("mode").getString()) { case "track": case "song": List<TrackEntity> tracks = this.search.searchforTracks(entites.get("name").getString(), 1); if (!tracks.isEmpty() && tracks.get(0) != null) { return Response.text(this.playerLogic.playTrack(0).toString()) .widget("app-current-song") .build(); } break; case "playlist": List<PlaylistEntity> playlists = this.search.searchforPlaylists(entites.get("name").getString(), 1); if (!playlists.isEmpty() && playlists.get(0) != null) { return Response.text(this.playerLogic.playPlaylist(0, SearchTypes.SEARCH_PLAYLISTS).toString()).build(); } break; case "album": List<AlbumEntity> albums = this.search.searchforAlbums(entites.get("name").getString(), 1); if (!albums.isEmpty() && albums.get(0) != null) { return Response.text(this.playerLogic.playAlbum(0).toString()).build(); } break; case "artist": List<ArtistEntity> artists = this.search.searchforArtists(entites.get("name").getString(), 1); if (!artists.isEmpty() && artists.get(0) != null) { return Response.text(this.playerLogic.playArtist(0).toString()).build(); } break; default: break; } return Response.text(ERROR_MESSAGE_ELEMENT).build(); }  @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 testSearchASong() { Map<String, EntityData> map = new HashMap<>(); when(this.songId.getString()).thenReturn("test"); map.put("name", this.songId); when(this.entityData.getString()).thenReturn("track"); map.put("mode", this.entityData); assertThat(this.speech.searchASong(map).getText(), equalTo("Element is not available")); verify(this.searchLogic).searchforTracks("test", 1); }