diff --git a/app/src/test/java/com/example/harmonyhub/components/FriendCardTest.kt b/app/src/test/java/com/example/harmonyhub/components/FriendCardTest.kt new file mode 100644 index 0000000..6312b69 --- /dev/null +++ b/app/src/test/java/com/example/harmonyhub/components/FriendCardTest.kt @@ -0,0 +1,26 @@ +package com.example.harmonyhub.components + +import com.example.harmonyhub.ui.components.Friend +import com.example.harmonyhub.ui.components.contains +import org.junit.Assert.assertEquals +import org.junit.Test + +class FriendCardTest { + @Test + fun testContains() { + val friend = Friend("nalgnaohel", "lanlehoang8124@gmail.com", 2) + assertEquals(friend.contains("nalgnaohel"), true) + } + + @Test + fun testNoContains() { + val friend = Friend("nalgnaohel", "lanlehoang8124@gmail.com", 2) + assertEquals(friend.contains("Penta"), false) + } + + @Test + fun testIgnoreCaseFalse() { + val friend = Friend("nalgnaohel", "lanlehoang8124@gmail.com", 2) + assertEquals(friend.contains("nALgnaohel", ignoreCase = false), false) + } +} \ No newline at end of file diff --git a/app/src/test/java/com/example/harmonyhub/components/PlaylistCardTest.kt b/app/src/test/java/com/example/harmonyhub/components/PlaylistCardTest.kt new file mode 100644 index 0000000..c961343 --- /dev/null +++ b/app/src/test/java/com/example/harmonyhub/components/PlaylistCardTest.kt @@ -0,0 +1,29 @@ +package com.example.harmonyhub.components + +import com.example.harmonyhub.ui.components.Playlist +import com.example.harmonyhub.ui.components.contains +import org.junit.Assert.assertEquals +import org.junit.Test + +class PlaylistCardTest { + @Test + fun testContains() { + // Test the PlaylistCard + var playlist = Playlist("Mood In Mind", 1); + assertEquals(playlist.contains("Mood"), true); + } + + @Test + fun testNoContains() { + // Test the PlaylistCard + var playlist = Playlist("Mood In Mind", 1); + assertEquals(playlist.contains("Penta"), false); + } + + @Test + fun testIgnoreCaseFalse() { + // Test the PlaylistCard + var playlist = Playlist("Mood In Mind", 1); + assertEquals(false, playlist.contains("mood", ignoreCase = false)); + } +} \ No newline at end of file diff --git a/app/src/test/java/com/example/harmonyhub/components/SongCardTest.kt b/app/src/test/java/com/example/harmonyhub/components/SongCardTest.kt index acc1c4f..0e7cb7d 100644 --- a/app/src/test/java/com/example/harmonyhub/components/SongCardTest.kt +++ b/app/src/test/java/com/example/harmonyhub/components/SongCardTest.kt @@ -26,4 +26,11 @@ class SongCardTest { var song = Song("1", "Conditionally", "Katy Perry", "imageResId", "url"); assertEquals(song.contains("Taylor"), false); } + + @Test + fun testIgnoreCaseFalse() { + // Test the SongCard + var song = Song("1", "Conditionally", "Katy Perry", "imageResId", "url"); + assertEquals(false, song.contains("perry", ignoreCase = false)); + } } \ No newline at end of file