Skip to content

Commit f639b29

Browse files
author
caiyg
committed
修改测试消息和Notification长度的单元测试用例
1 parent c0f38ec commit f639b29

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

src/test/java/cn/jpush/api/push/model/PushPayloadTest.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,25 @@ public void testGlobalExceed() {
107107
PushPayload payload = PushPayload.newBuilder()
108108
.setPlatform(Platform.all())
109109
.setAudience(Audience.all())
110-
.setMessage(Message.content(LONG_TEXT_3))
110+
.setMessage(Message.content(LONG_TEXT_2))
111111
.build();
112-
System.out.println("Size: " + LONG_TEXT_3.getBytes().length);
113-
Assert.assertTrue("Should exceed - " + LONG_TEXT_3.getBytes().length,
112+
System.out.println("Size: " + LONG_TEXT_2.getBytes().length);
113+
Assert.assertFalse("Shouldn't exceed - " + LONG_TEXT_2.getBytes().length,
114114
payload.isGlobalExceedLength());
115115
}
116116

117+
@Test
118+
public void testGlobalExeed2() {
119+
PushPayload payload = PushPayload.newBuilder()
120+
.setPlatform(Platform.all())
121+
.setAudience(Audience.all())
122+
.setMessage(Message.content(LONG_TEXT_3))
123+
.build();
124+
System.out.println("Size: " + LONG_TEXT_3.getBytes().length);
125+
Assert.assertTrue("Should exeed - " + LONG_TEXT_3.getBytes().length,
126+
payload.isGlobalExceedLength());
127+
}
128+
117129
@Test
118130
public void testIosExceed() {
119131
PushPayload payload = PushPayload.newBuilder()
@@ -122,7 +134,7 @@ public void testIosExceed() {
122134
.setNotification(Notification.alert(LONG_TEXT_1))
123135
.build();
124136
System.out.println("Size: " + LONG_TEXT_1.getBytes().length);
125-
Assert.assertTrue("Should exceed - " + LONG_TEXT_1.getBytes().length,
137+
Assert.assertFalse("Shouldn't exceed - " + LONG_TEXT_1.getBytes().length,
126138
payload.isIosExceedLength());
127139
}
128140

@@ -132,10 +144,10 @@ public void testIosExceed2() {
132144
.setPlatform(Platform.all())
133145
.setAudience(Audience.all())
134146
.setNotification(Notification.newBuilder().addPlatformNotification(
135-
IosNotification.alert(LONG_TEXT_1)).build())
147+
IosNotification.alert(LONG_TEXT_3)).build())
136148
.build();
137-
System.out.println("Size: " + LONG_TEXT_1.getBytes().length);
138-
Assert.assertTrue("Should exceed - " + LONG_TEXT_1.getBytes().length,
149+
System.out.println("Size: " + LONG_TEXT_3.getBytes().length);
150+
Assert.assertTrue("Should exceed - " + LONG_TEXT_3.getBytes().length,
139151
payload.isIosExceedLength());
140152
}
141153

0 commit comments

Comments
 (0)