|
29 | 29 |
|
30 | 30 | import java.io.IOException; |
31 | 31 | import java.net.URI; |
| 32 | +import java.util.Collections; |
32 | 33 |
|
33 | 34 | import org.junit.Rule; |
34 | 35 | import org.junit.Test; |
|
48 | 49 | import com.linecorp.bot.model.group.GroupSummaryResponse; |
49 | 50 | import com.linecorp.bot.model.message.TextMessage; |
50 | 51 | import com.linecorp.bot.model.narrowcast.Filter; |
| 52 | +import com.linecorp.bot.model.narrowcast.Limit; |
51 | 53 | import com.linecorp.bot.model.narrowcast.filter.GenderDemographicFilter; |
52 | 54 | import com.linecorp.bot.model.narrowcast.filter.GenderDemographicFilter.Gender; |
53 | 55 | import com.linecorp.bot.model.profile.MembersIdsResponse; |
@@ -171,6 +173,30 @@ public void narrowcast() { |
171 | 173 | assertThat(botApiResponse).isEqualTo(BOT_API_SUCCESS_RESPONSE); |
172 | 174 | } |
173 | 175 |
|
| 176 | + @Test |
| 177 | + public void narrowcast2() { |
| 178 | + whenCall(retrofitMock.narrowcast(isNull(), any(Narrowcast.class)), |
| 179 | + BOT_API_SUCCESS_RESPONSE_BODY); |
| 180 | + final Narrowcast narrowcast = new Narrowcast( |
| 181 | + Collections.singletonList(new TextMessage("text")), |
| 182 | + null, |
| 183 | + Filter.builder() |
| 184 | + .demographic( |
| 185 | + GenderDemographicFilter.builder() |
| 186 | + .oneOf(singletonList(Gender.FEMALE)) |
| 187 | + .build() |
| 188 | + ).build(), |
| 189 | + Limit.builder() |
| 190 | + .upToRemainingQuota(true) |
| 191 | + .build(), |
| 192 | + false |
| 193 | + ); |
| 194 | + |
| 195 | + final BotApiResponse botApiResponse = target.narrowcast(narrowcast).join(); |
| 196 | + verify(retrofitMock).narrowcast(null, narrowcast); |
| 197 | + assertThat(botApiResponse).isEqualTo(BOT_API_SUCCESS_RESPONSE); |
| 198 | + } |
| 199 | + |
174 | 200 | @Test |
175 | 201 | public void getNarrowcastProgress() { |
176 | 202 | whenCall(retrofitMock.getNarrowcastProgress(any()), |
|
0 commit comments