Skip to content

Commit

Permalink
Added test from raw String
Browse files Browse the repository at this point in the history
Signed-off-by: Arnau Mora <[email protected]>
  • Loading branch information
ArnyminerZ committed Nov 5, 2023
1 parent 5695613 commit 8f98953
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import org.junit.Assert.*
import java.io.ByteArrayOutputStream
import java.io.StringReader
import java.time.LocalDate
import java.time.OffsetDateTime
import java.time.ZoneOffset

class AndroidContactTest {

Expand Down Expand Up @@ -122,6 +124,29 @@ class AndroidContactTest {
}
}

@Test
fun testBirthdayWithOffset() {
val vCard = "BEGIN:VCARD\r\n" +
"VERSION:3.0\n\n" +
"N:Doe;John;;;\n\n" +
"FN:John Doe\n\n" +
"BDAY:20010415T000000+0200\n\n" +
"END:VCARD\n\n"
val contacts = Contact.fromReader(StringReader(vCard), false, null)

assertEquals(1, contacts.size)
contacts.first().birthDay.let { birthday ->
assertNotNull(birthday)

val date = birthday?.date
assertNotNull(date)

assertEquals(
OffsetDateTime.of(2001, 4, 15, 0, 0, 0, 0, ZoneOffset.ofHours(2)), date
)
}
}

@Test
@MediumTest
fun testLargeTransactionManyRows() {
Expand Down

0 comments on commit 8f98953

Please sign in to comment.