Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Nullability Annotations to Java Classes] Add Missing Nullability Annotations to Theme Model Classes (breaking) #2897

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void testInstallTheme() throws InterruptedException {
}

// install the theme
ThemeModel themeToInstall = new ThemeModel();
@SuppressWarnings("deprecation") ThemeModel themeToInstall = new ThemeModel();
themeToInstall.setThemeId(themeId);
installTheme(jetpackSite, themeToInstall);
assertTrue(isThemeInstalled(jetpackSite, themeId));
Expand All @@ -179,7 +179,7 @@ public void testDeleteTheme() throws InterruptedException {

// Install edin if necessary before attempting to delete
if (!isThemeInstalled(jetpackSite, themeId)) {
ThemeModel themeToInstall = new ThemeModel();
@SuppressWarnings("deprecation") ThemeModel themeToInstall = new ThemeModel();
themeToInstall.setThemeId(themeId);
installTheme(jetpackSite, themeToInstall);

Expand All @@ -189,8 +189,10 @@ public void testDeleteTheme() throws InterruptedException {

// Get the theme from store to make sure the "active" state is correct, so we can deactivate it before deletion
ThemeModel themeToDelete = mThemeStore.getInstalledThemeByThemeId(jetpackSite, EDIN_THEME_ID);
// if Edin is active update site's active theme to something else and delete Edin
deactivateAndDeleteTheme(jetpackSite, themeToDelete);
if (themeToDelete != null) {
// if Edin is active update site's active theme to something else and delete Edin
deactivateAndDeleteTheme(jetpackSite, themeToDelete);
}

signOutWPCom();
}
Expand Down Expand Up @@ -427,7 +429,9 @@ private void deactivateAndDeleteTheme(@NonNull SiteModel jetpackSite, @NonNull T
activateTheme(jetpackSite, otherThemeToActivate);

// Make sure another theme is activated
assertNotEquals(theme.getThemeId(), mThemeStore.getActiveThemeForSite(jetpackSite).getThemeId());
ThemeModel activeTheme = mThemeStore.getActiveThemeForSite(jetpackSite);
assertNotNull(activeTheme);
assertNotEquals(theme.getThemeId(), activeTheme.getThemeId());
}
// delete existing theme from site
deleteTheme(jetpackSite, theme);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ThemeFragment : Fragment() {
if (site == null) {
prependToLog("No WP.com site found, unable to test.")
} else {
val theme = ThemeModel()
@Suppress("DEPRECATION") val theme = ThemeModel()
theme.localSiteId = site.id
theme.themeId = id
val payload = ThemeStore.SiteThemePayload(site, theme)
Expand All @@ -110,7 +110,7 @@ class ThemeFragment : Fragment() {
if (site == null) {
prependToLog("No Jetpack connected site found, unable to test.")
} else {
val theme = ThemeModel()
@Suppress("DEPRECATION") val theme = ThemeModel()
theme.localSiteId = site.id
theme.themeId = id
val payload = ThemeStore.SiteThemePayload(site, theme)
Expand All @@ -128,7 +128,7 @@ class ThemeFragment : Fragment() {
if (site == null) {
prependToLog("No Jetpack connected site found, unable to test.")
} else {
val theme = ThemeModel()
@Suppress("DEPRECATION") val theme = ThemeModel()
theme.localSiteId = site.id
theme.themeId = id
val payload = ThemeStore.SiteThemePayload(site, theme)
Expand All @@ -146,7 +146,7 @@ class ThemeFragment : Fragment() {
if (site == null) {
prependToLog("No Jetpack connected site found, unable to test.")
} else {
val theme = ThemeModel()
@Suppress("DEPRECATION") val theme = ThemeModel()
theme.localSiteId = site.id
theme.themeId = id
val payload = ThemeStore.SiteThemePayload(site, theme)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void testRemoveInstalledSiteThemes() throws SiteSqlUtils.DuplicateSiteExc
}

private ThemeModel generateTestTheme(int siteId, String themeId, String themeName) {
ThemeModel theme = new ThemeModel();
@SuppressWarnings("deprecation") ThemeModel theme = new ThemeModel();
theme.setLocalSiteId(siteId);
theme.setThemeId(themeId);
theme.setName(themeName);
Expand Down
Loading
Loading