Skip to content

Commit 61f290c

Browse files
committed
add test
1 parent 44fe65e commit 61f290c

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/main/java/com/qiniu/sms/SmsManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,17 @@ public Response describeTemplate(String templateId) throws QiniuException {
225225
return get(requestUrl);
226226
}
227227

228+
/**
229+
* 查询单个模板信息
230+
*
231+
* @param templateId 模板ID
232+
*/
233+
public TemplateInfo.Item describeTemplateItem(String templateId) throws QiniuException {
234+
Response resp = describeTemplate(templateId);
235+
TemplateInfo.Item item = Json.decode(resp.bodyString(), TemplateInfo.Item.class);
236+
return item;
237+
}
238+
228239
/**
229240
* 创建模板
230241
*

src/test/java/test/com/qiniu/sms/SmsTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,18 @@ public void testDescribeSingleTemplate() {
196196
}
197197
}
198198

199+
@Test
200+
@Tag("IntegrationTest")
201+
public void testDescribeSingleTemplateItem() {
202+
try {
203+
TemplateInfo.Item item = smsManager.describeTemplateItem("templateId");
204+
assertNotNull(item);
205+
} catch (QiniuException e) {
206+
assertTrue(ResCode.find(e.code(), ResCode.getPossibleResCode(401)));
207+
}
208+
}
209+
210+
199211
@Test
200212
@Tag("IntegrationTest")
201213
public void testCreateTemplate() {

0 commit comments

Comments
 (0)