Skip to content

Commit 2ffa0dc

Browse files
committed
Api Version 10
1 parent 46a9237 commit 2ffa0dc

25 files changed

Lines changed: 964 additions & 19 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>org.telegram</groupId>
88
<artifactId>Bots</artifactId>
99
<packaging>pom</packaging>
10-
<version>9.6.0</version>
10+
<version>10.0.0</version>
1111

1212
<modules>
1313
<module>telegrambots-meta</module>

telegrambots-abilities/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.telegram</groupId>
99
<artifactId>Bots</artifactId>
10-
<version>9.6.0</version>
10+
<version>10.0.0</version>
1111
</parent>
1212

1313
<artifactId>telegrambots-abilities</artifactId>
@@ -93,12 +93,12 @@
9393
<dependency>
9494
<groupId>org.telegram</groupId>
9595
<artifactId>telegrambots-webhook</artifactId>
96-
<version>9.6.0</version>
96+
<version>10.0.0</version>
9797
</dependency>
9898
<dependency>
9999
<groupId>org.telegram</groupId>
100100
<artifactId>telegrambots-longpolling</artifactId>
101-
<version>9.6.0</version>
101+
<version>10.0.0</version>
102102
</dependency>
103103

104104
<dependency>

telegrambots-client-jetty-adapter/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.telegram</groupId>
99
<artifactId>Bots</artifactId>
10-
<version>9.6.0</version>
10+
<version>10.0.0</version>
1111
</parent>
1212

1313
<name>Telegram Bots Client Jetty HttpClient adapter</name>

telegrambots-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.telegram</groupId>
99
<artifactId>Bots</artifactId>
10-
<version>9.6.0</version>
10+
<version>10.0.0</version>
1111
</parent>
1212

1313
<name>Telegram Bots Client</name>

telegrambots-extensions/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
1616
<dependency>
1717
<groupId>org.telegram</groupId>
1818
<artifactId>telegrambots-extensions</artifactId>
19-
<version>9.6.0</version>
19+
<version>10.0.0</version>
2020
</dependency>
2121
```
2222

2323
2. Using Gradle:
2424

2525
```gradle
26-
implementation 'org.telegram:telegrambots-extensions:9.6.0'
26+
implementation 'org.telegram:telegrambots-extensions:10.0.0'
2727
```

telegrambots-extensions/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.telegram</groupId>
99
<artifactId>Bots</artifactId>
10-
<version>9.6.0</version>
10+
<version>10.0.0</version>
1111
</parent>
1212

1313
<artifactId>telegrambots-extensions</artifactId>
@@ -78,12 +78,12 @@
7878
<dependency>
7979
<groupId>org.telegram</groupId>
8080
<artifactId>telegrambots-webhook</artifactId>
81-
<version>9.6.0</version>
81+
<version>10.0.0</version>
8282
</dependency>
8383
<dependency>
8484
<groupId>org.telegram</groupId>
8585
<artifactId>telegrambots-longpolling</artifactId>
86-
<version>9.6.0</version>
86+
<version>10.0.0</version>
8787
</dependency>
8888

8989
<dependency>

telegrambots-longpolling/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.telegram</groupId>
88
<artifactId>Bots</artifactId>
9-
<version>9.6.0</version>
9+
<version>10.0.0</version>
1010
</parent>
1111

1212
<artifactId>telegrambots-longpolling</artifactId>

telegrambots-meta/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.telegram</groupId>
99
<artifactId>Bots</artifactId>
10-
<version>9.6.0</version>
10+
<version>10.0.0</version>
1111
</parent>
1212

1313
<artifactId>telegrambots-meta</artifactId>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package org.telegram.telegrambots.meta.api.methods.managed;
2+
3+
import org.junit.jupiter.api.Test;
4+
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
5+
6+
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
7+
import static org.junit.jupiter.api.Assertions.assertEquals;
8+
import static org.junit.jupiter.api.Assertions.assertThrows;
9+
10+
/**
11+
* @author Ruben Bermudez
12+
* @version 10.0
13+
*/
14+
public class TestGetManagedBotAccessSettings {
15+
16+
@Test
17+
public void testGetManagedBotAccessSettingsGetPath() {
18+
GetManagedBotAccessSettings method = GetManagedBotAccessSettings.builder()
19+
.userId(123456789L)
20+
.build();
21+
22+
assertEquals("getManagedBotAccessSettings", method.getMethod());
23+
}
24+
25+
@Test
26+
public void testGetManagedBotAccessSettingsValidation() {
27+
GetManagedBotAccessSettings method = GetManagedBotAccessSettings.builder()
28+
.userId(123456789L)
29+
.build();
30+
31+
assertDoesNotThrow(method::validate);
32+
}
33+
34+
@Test
35+
public void testGetManagedBotAccessSettingsMissingUserId() {
36+
assertThrows(NullPointerException.class, () -> GetManagedBotAccessSettings.builder()
37+
.build());
38+
}
39+
40+
@Test
41+
public void testGetManagedBotAccessSettingsZeroUserId() {
42+
GetManagedBotAccessSettings method = GetManagedBotAccessSettings.builder()
43+
.userId(0L)
44+
.build();
45+
46+
assertThrows(TelegramApiValidationException.class, method::validate);
47+
}
48+
49+
@Test
50+
public void testGetManagedBotAccessSettingsUserId() {
51+
GetManagedBotAccessSettings method = GetManagedBotAccessSettings.builder()
52+
.userId(123456789L)
53+
.build();
54+
55+
assertEquals(123456789L, method.getUserId());
56+
}
57+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package org.telegram.telegrambots.meta.api.methods.managed;
2+
3+
import org.junit.jupiter.api.Test;
4+
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
5+
6+
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
7+
import static org.junit.jupiter.api.Assertions.assertEquals;
8+
import static org.junit.jupiter.api.Assertions.assertThrows;
9+
10+
/**
11+
* @author Ruben Bermudez
12+
* @version 10.0
13+
*/
14+
public class TestSetManagedBotAccessSettings {
15+
16+
@Test
17+
public void testSetManagedBotAccessSettingsGetPath() {
18+
SetManagedBotAccessSettings method = SetManagedBotAccessSettings.builder()
19+
.userId(123456789L)
20+
.isAccessRestricted(false)
21+
.build();
22+
23+
assertEquals("setManagedBotAccessSettings", method.getMethod());
24+
}
25+
26+
@Test
27+
public void testSetManagedBotAccessSettingsValidation() {
28+
SetManagedBotAccessSettings method = SetManagedBotAccessSettings.builder()
29+
.userId(123456789L)
30+
.isAccessRestricted(false)
31+
.build();
32+
33+
assertDoesNotThrow(method::validate);
34+
}
35+
36+
@Test
37+
public void testSetManagedBotAccessSettingsMissingUserId() {
38+
assertThrows(NullPointerException.class, () -> SetManagedBotAccessSettings.builder()
39+
.isAccessRestricted(false)
40+
.build());
41+
}
42+
43+
@Test
44+
public void testSetManagedBotAccessSettingsMissingIsAccessRestricted() {
45+
assertThrows(NullPointerException.class, () -> SetManagedBotAccessSettings.builder()
46+
.userId(123456789L)
47+
.build());
48+
}
49+
50+
@Test
51+
public void testSetManagedBotAccessSettingsZeroUserId() {
52+
SetManagedBotAccessSettings method = SetManagedBotAccessSettings.builder()
53+
.userId(0L)
54+
.isAccessRestricted(false)
55+
.build();
56+
57+
assertThrows(TelegramApiValidationException.class, method::validate);
58+
}
59+
60+
@Test
61+
public void testSetManagedBotAccessSettingsWithAddedUserIds() {
62+
SetManagedBotAccessSettings method = SetManagedBotAccessSettings.builder()
63+
.userId(123456789L)
64+
.isAccessRestricted(true)
65+
.addedUserId(111L)
66+
.addedUserId(222L)
67+
.build();
68+
69+
assertDoesNotThrow(method::validate);
70+
assertEquals(2, method.getAddedUserIds().size());
71+
}
72+
73+
@Test
74+
public void testSetManagedBotAccessSettingsTooManyAddedUserIds() {
75+
SetManagedBotAccessSettings.SetManagedBotAccessSettingsBuilder<?, ?> builder = SetManagedBotAccessSettings.builder()
76+
.userId(123456789L)
77+
.isAccessRestricted(true);
78+
79+
for (int i = 1; i <= 11; i++) {
80+
builder.addedUserId((long) i);
81+
}
82+
SetManagedBotAccessSettings method = builder.build();
83+
84+
assertThrows(TelegramApiValidationException.class, method::validate);
85+
}
86+
}

0 commit comments

Comments
 (0)