-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
851 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
pillarbox-core-business/src/test/java/ch/srgssr/pillarbox/core/business/MediaItemUrnTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) SRG SSR. All rights reserved. | ||
* License information is available from the LICENSE file. | ||
*/ | ||
package ch.srgssr.pillarbox.core.business | ||
|
||
import androidx.core.net.toUri | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertNull | ||
|
||
class MediaItemUrnTest { | ||
@Test | ||
fun `MediaItemUrn with all parameters`() { | ||
val urn = "urn:rts:audio:3262363" | ||
val title = "Media title" | ||
val subtitle = "Media subtitle" | ||
val artworkUri = "Artwork uri".toUri() | ||
val mediaItem = MediaItemUrn( | ||
urn = urn, | ||
title = title, | ||
subtitle = subtitle, | ||
artworkUri = artworkUri, | ||
) | ||
|
||
assertEquals(urn, mediaItem.mediaId) | ||
assertEquals(title, mediaItem.mediaMetadata.title) | ||
assertEquals(subtitle, mediaItem.mediaMetadata.subtitle) | ||
assertEquals(artworkUri, mediaItem.mediaMetadata.artworkUri) | ||
} | ||
|
||
@Test | ||
fun `MediaItemUrn with urn only`() { | ||
val urn = "urn:rts:audio:3262363" | ||
val mediaItem = MediaItemUrn( | ||
urn = urn, | ||
) | ||
|
||
assertEquals(urn, mediaItem.mediaId) | ||
assertNull(mediaItem.mediaMetadata.title) | ||
assertNull(mediaItem.mediaMetadata.subtitle) | ||
assertNull(mediaItem.mediaMetadata.artworkUri) | ||
} | ||
} |
67 changes: 0 additions & 67 deletions
67
pillarbox-core-business/src/test/java/ch/srgssr/pillarbox/core/business/MediaUrnTest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...ess/src/test/java/ch/srgssr/pillarbox/core/business/exception/BlockReasonExceptionTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) SRG SSR. All rights reserved. | ||
* License information is available from the LICENSE file. | ||
*/ | ||
package ch.srgssr.pillarbox.core.business.exception | ||
|
||
import ch.srgssr.pillarbox.core.business.integrationlayer.data.BlockReason | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class BlockReasonExceptionTest { | ||
@Test | ||
fun `BlockReasonException created with a BlockReason`() { | ||
BlockReason.entries.forEach { blockReason -> | ||
val exception = BlockReasonException(blockReason) | ||
|
||
assertEquals(blockReason.name, exception.message) | ||
} | ||
} | ||
|
||
@Test | ||
fun `BlockReasonException created with a message matching a BlockReason`() { | ||
BlockReason.entries.forEach { blockReason -> | ||
val exception = BlockReasonException(blockReason.name) | ||
|
||
assertEquals(blockReason.name, exception.message) | ||
} | ||
} | ||
|
||
@Test | ||
fun `BlockReasonException created with a message not matching a BlockReason`() { | ||
val exception = BlockReasonException("FOO_BAR") | ||
|
||
assertEquals(BlockReason.UNKNOWN.name, exception.message) | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...ore-business/src/test/java/ch/srgssr/pillarbox/core/business/extension/BlockReasonTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (c) SRG SSR. All rights reserved. | ||
* License information is available from the LICENSE file. | ||
*/ | ||
package ch.srgssr.pillarbox.core.business.extension | ||
|
||
import ch.srgssr.pillarbox.core.business.R | ||
import ch.srgssr.pillarbox.core.business.integrationlayer.data.BlockReason | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class BlockReasonTest { | ||
@Test | ||
fun `get string resId for BlockReason`() { | ||
assertEquals(R.string.blockReason_ageRating12, BlockReason.AGERATING12.getStringResId()) | ||
assertEquals(R.string.blockReason_ageRating18, BlockReason.AGERATING18.getStringResId()) | ||
assertEquals(R.string.blockReason_commercial, BlockReason.COMMERCIAL.getStringResId()) | ||
assertEquals(R.string.blockReason_endDate, BlockReason.ENDDATE.getStringResId()) | ||
assertEquals(R.string.blockReason_geoBlock, BlockReason.GEOBLOCK.getStringResId()) | ||
assertEquals(R.string.blockReason_legal, BlockReason.LEGAL.getStringResId()) | ||
assertEquals(R.string.blockReason_startDate, BlockReason.STARTDATE.getStringResId()) | ||
assertEquals(R.string.blockReason_unknown, BlockReason.UNKNOWN.getStringResId()) | ||
} | ||
} |
Oops, something went wrong.