11package org.wordpress.android.fluxc.mocked
22
3+ import android.os.Bundle
34import org.greenrobot.eventbus.Subscribe
45import org.greenrobot.eventbus.ThreadMode
56import org.junit.Assert
@@ -46,9 +47,17 @@ class MockedStack_EditorThemeStoreTest : MockedStack_Base() {
4647
4748 // See onEditorThemeChanged for the latch's countdown to fire.
4849 Assert .assertTrue(countDownLatch.await(TestUtils .DEFAULT_TIMEOUT_MS .toLong(), MILLISECONDS ))
50+
51+ // Validate Callback
4952 assertNotEmpty(editorTheme)
53+
54+ // Validate Cache
5055 val cachedTheme = editorThemeStore.getEditorThemeForSite(site)
5156 assertNotEmpty(cachedTheme)
57+
58+ // Validate Bundle
59+ val themeBundle = editorTheme!! .themeSupport.toBundle()
60+ assertNotEmpty(themeBundle)
5261 }
5362
5463 @Test
@@ -58,9 +67,17 @@ class MockedStack_EditorThemeStoreTest : MockedStack_Base() {
5867
5968 // See onEditorThemeChanged for the latch's countdown to fire.
6069 Assert .assertTrue(countDownLatch.await(TestUtils .DEFAULT_TIMEOUT_MS .toLong(), MILLISECONDS ))
70+
71+ // Validate Callback
6172 assertEmpty(editorTheme)
73+
74+ // Validate Cache
6275 val cachedTheme = editorThemeStore.getEditorThemeForSite(site)
6376 assertEmpty(cachedTheme)
77+
78+ // Validate Bundle
79+ val themeBundle = editorTheme!! .themeSupport.toBundle()
80+ assertEmpty(themeBundle)
6481 }
6582
6683 private fun assertNotEmpty (theme : EditorTheme ? ) {
@@ -69,8 +86,22 @@ class MockedStack_EditorThemeStoreTest : MockedStack_Base() {
6986 }
7087
7188 private fun assertEmpty (theme : EditorTheme ? ) {
72- Assert .assertTrue(theme?.themeSupport?.colors.isNullOrEmpty())
73- Assert .assertTrue(theme?.themeSupport?.gradients.isNullOrEmpty())
89+ Assert .assertTrue(theme?.themeSupport?.colors == null )
90+ Assert .assertTrue(theme?.themeSupport?.gradients == null )
91+ }
92+
93+ private fun assertEmpty (theme : Bundle ) {
94+ val colors = theme.getSerializable(" colors" )
95+ val gradients = theme.getSerializable(" gradients" )
96+ Assert .assertTrue(colors == null )
97+ Assert .assertTrue(gradients == null )
98+ }
99+
100+ private fun assertNotEmpty (theme : Bundle ) {
101+ val colors = theme.getSerializable(" colors" ) as ArrayList <* >
102+ val gradients = theme.getSerializable(" gradients" ) as ArrayList <* >
103+ Assert .assertFalse(colors.isNullOrEmpty())
104+ Assert .assertFalse(gradients.isNullOrEmpty())
74105 }
75106
76107 @Suppress(" unused" )
0 commit comments