Skip to content

Commit 7af6e8b

Browse files
committed
Make the birthday in the UserAbout a String
Java does not properly support the given dates (e.g. 0000-02-06).
1 parent 7d4ef27 commit 7af6e8b

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

library/src/main/java/me/proxer/library/entity/user/UserAbout.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import me.proxer.library.enums.RelationshipStatus;
88

99
import javax.annotation.Nullable;
10-
import java.util.Date;
1110

1211
/**
1312
* Entity holding all info of a user.
@@ -94,7 +93,7 @@ public class UserAbout {
9493
* Returns the birthday of the user. Can be an actual date or 00.00.0000. The format is dd.MM.yyyy.
9594
*/
9695
@Json(name = "info_birthday")
97-
private Date birthday;
96+
private String birthday;
9897

9998
/**
10099
* Returns the gender of the user.

library/src/test/java/me/proxer/library/api/user/UserAboutEndpointTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
import org.junit.Test;
1010

1111
import java.io.IOException;
12-
import java.text.ParseException;
13-
import java.text.SimpleDateFormat;
14-
import java.util.Locale;
1512

1613
import static org.assertj.core.api.Assertions.assertThat;
1714
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -22,7 +19,7 @@
2219
public class UserAboutEndpointTest extends ProxerTest {
2320

2421
@Test
25-
public void testDefault() throws ProxerException, IOException, ParseException {
22+
public void testDefault() throws ProxerException, IOException {
2623
server.enqueue(new MockResponse().setBody(fromResource("user_about.json")));
2724

2825
final UserAbout result = api.user()
@@ -50,10 +47,9 @@ public void testUserIdAndUsernameNull() {
5047
.isThrownBy(() -> api.user().info(null, null));
5148
}
5249

53-
private UserAbout buildTestAbout() throws ParseException {
50+
private UserAbout buildTestAbout() {
5451
return new UserAbout("", "Developer", "Anime", "A City", "Some Country",
5552
"<p>Hello there", "", "", "", "", "skypeTest",
56-
"", new SimpleDateFormat("yyyy-MM-dd", Locale.GERMANY).parse("0000-06-02"),
57-
Gender.MALE, RelationshipStatus.UNKNOWN);
53+
"", "0000-06-02", Gender.MALE, RelationshipStatus.UNKNOWN);
5854
}
5955
}

0 commit comments

Comments
 (0)