From 3264bb50fc776283527db01958eb14dd70390a7a Mon Sep 17 00:00:00 2001 From: JanFidor Date: Fri, 11 Nov 2022 22:15:03 +0100 Subject: [PATCH] fix spotless errors with line length --- .../feature/author/AuthorRobot.kt | 23 ++--- .../feature/author/AuthorScreenTest.kt | 3 +- .../feature/bookmarks/BookmarksRobot.kt | 83 ++++++++----------- .../feature/bookmarks/BookmarksScreenTest.kt | 3 +- .../feature/foryou/ForYouRobot.kt | 23 ++--- .../feature/foryou/ForYouScreenTest.kt | 3 +- .../nowinandroid/interests/InterestsRobot.kt | 23 ++--- .../interests/InterestsScreenTest.kt | 4 +- .../feature/settings/SettingsDialogRobot.kt | 23 ++--- .../feature/settings/SettingsDialogTest.kt | 3 +- .../nowinandroid/feature/topic/TopicRobot.kt | 23 ++--- .../feature/topic/TopicScreenTest.kt | 3 +- 12 files changed, 106 insertions(+), 111 deletions(-) diff --git a/feature/author/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/author/AuthorRobot.kt b/feature/author/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/author/AuthorRobot.kt index ae35b0118..98cc43a5e 100644 --- a/feature/author/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/author/AuthorRobot.kt +++ b/feature/author/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/author/AuthorRobot.kt @@ -1,17 +1,17 @@ /* * Copyright 2022 The Android Open Source Project * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.google.samples.apps.nowinandroid.feature.author @@ -25,7 +25,8 @@ import com.google.samples.apps.nowinandroid.core.domain.model.FollowableAuthor import com.google.samples.apps.nowinandroid.core.model.data.NewsResource internal class AuthorRobot( - private val composeTestRule: AndroidComposeTestRule, ComponentActivity> + private val composeTestRule: AndroidComposeTestRule< + ActivityScenarioRule, ComponentActivity> ) { fun setContent(authorUiState: AuthorUiState, newsUiState: NewsUiState) { composeTestRule.setContent { @@ -62,4 +63,4 @@ internal class AuthorRobot( .onNodeWithText(newsResource.title) .assertExists() } -} \ No newline at end of file +} diff --git a/feature/author/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/author/AuthorScreenTest.kt b/feature/author/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/author/AuthorScreenTest.kt index 23654f2b2..74968f764 100644 --- a/feature/author/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/author/AuthorScreenTest.kt +++ b/feature/author/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/author/AuthorScreenTest.kt @@ -101,7 +101,8 @@ class AuthorScreenTest { } private fun launchAuthorRobot( - composeTestRule: AndroidComposeTestRule, ComponentActivity>, + composeTestRule: AndroidComposeTestRule< + ActivityScenarioRule, ComponentActivity>, authorUiState: AuthorUiState, newsUiState: NewsUiState, func: AuthorRobot.() -> Unit diff --git a/feature/bookmarks/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksRobot.kt b/feature/bookmarks/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksRobot.kt index ce1a0c952..675becca5 100644 --- a/feature/bookmarks/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksRobot.kt +++ b/feature/bookmarks/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksRobot.kt @@ -1,17 +1,17 @@ /* * Copyright 2022 The Android Open Source Project * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.google.samples.apps.nowinandroid.feature.bookmarks @@ -35,68 +35,53 @@ import com.google.samples.apps.nowinandroid.core.model.data.NewsResource import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState internal class BookmarksRobot( - private val composeTestRule: AndroidComposeTestRule, ComponentActivity> + private val composeTestRule: AndroidComposeTestRule< + ActivityScenarioRule, ComponentActivity> ) { private val removedBookmarks = mutableSetOf() fun setContent(newsFeedUiState: NewsFeedUiState) { composeTestRule.setContent { - BookmarksScreen( - feedState = newsFeedUiState, - removeFromBookmarks = { - removedBookmarks.add(it) - } - ) + BookmarksScreen(feedState = newsFeedUiState, removeFromBookmarks = { + removedBookmarks.add(it) + }) } } fun loadingIndicatorShown() { - composeTestRule - .onNodeWithContentDescription( - composeTestRule.activity.resources.getString(R.string.saved_loading) - ) - .assertExists() + composeTestRule.onNodeWithContentDescription( + composeTestRule.activity.resources.getString(R.string.saved_loading) + ).assertExists() } fun clickableNewsResourceExists(newsResource: NewsResource) { - composeTestRule - .onNodeWithText( - newsResource.title, - substring = true - ) - .assertExists() - .assertHasClickAction() + composeTestRule.onNodeWithText( + newsResource.title, substring = true + ).assertExists().assertHasClickAction() } fun scrollToNewsResource(newsResource: NewsResource) { - composeTestRule.onNode(hasScrollToNodeAction()) - .performScrollToNode( - hasText( - newsResource.title, - substring = true - ) + composeTestRule.onNode(hasScrollToNodeAction()).performScrollToNode( + hasText( + newsResource.title, substring = true ) + ) } fun clickNewsResourceBookmark(newsResource: NewsResource) { - composeTestRule - .onAllNodesWithContentDescription( - composeTestRule.activity.getString( - com.google.samples.apps.nowinandroid.core.ui.R.string.unbookmark - ) - ).filter( - hasAnyAncestor( - hasText( - newsResource.title, - substring = true - ) + composeTestRule.onAllNodesWithContentDescription( + composeTestRule.activity.getString( + com.google.samples.apps.nowinandroid.core.ui.R.string.unbookmark + ) + ).filter( + hasAnyAncestor( + hasText( + newsResource.title, substring = true ) ) - .assertCountEquals(1) - .onFirst() - .performClick() + ).assertCountEquals(1).onFirst().performClick() } fun removedNewsResourceBookmark(newsResource: NewsResource) = removedBookmarks.contains(newsResource.id) -} \ No newline at end of file +} diff --git a/feature/bookmarks/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksScreenTest.kt b/feature/bookmarks/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksScreenTest.kt index 81332f98d..70314c87e 100644 --- a/feature/bookmarks/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksScreenTest.kt +++ b/feature/bookmarks/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksScreenTest.kt @@ -75,7 +75,8 @@ class BookmarksScreenTest { } private fun launchBookmarksRobot( - composeTestRule: AndroidComposeTestRule, ComponentActivity>, + composeTestRule: AndroidComposeTestRule< + ActivityScenarioRule, ComponentActivity>, newsFeedUiState: NewsFeedUiState, func: BookmarksRobot.() -> Unit ) = BookmarksRobot(composeTestRule).apply { diff --git a/feature/foryou/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouRobot.kt b/feature/foryou/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouRobot.kt index 0c81da3d0..02d113389 100644 --- a/feature/foryou/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouRobot.kt +++ b/feature/foryou/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouRobot.kt @@ -1,17 +1,17 @@ /* * Copyright 2022 The Android Open Source Project * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.google.samples.apps.nowinandroid.feature.foryou @@ -36,7 +36,8 @@ import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState import com.google.samples.apps.nowinandroid.feature.foryou.R.string internal class ForYouRobot( - private val composeTestRule: AndroidComposeTestRule, ComponentActivity> + private val composeTestRule: AndroidComposeTestRule< + ActivityScenarioRule, ComponentActivity> ) { private val doneButtonMatcher by lazy { hasText(composeTestRule.activity.resources.getString(string.done)) @@ -120,4 +121,4 @@ internal class ForYouRobot( ) ) } -} \ No newline at end of file +} diff --git a/feature/foryou/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenTest.kt b/feature/foryou/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenTest.kt index 9286da727..e5eef11a3 100644 --- a/feature/foryou/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenTest.kt +++ b/feature/foryou/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenTest.kt @@ -185,7 +185,8 @@ class ForYouScreenTest { } private fun launchForYouRobot( - composeTestRule: AndroidComposeTestRule, ComponentActivity>, + composeTestRule: AndroidComposeTestRule< + ActivityScenarioRule, ComponentActivity>, isSyncing: Boolean, onboardingState: OnboardingUiState, feedState: NewsFeedUiState, diff --git a/feature/interests/src/androidTest/java/com/google/samples/apps/nowinandroid/interests/InterestsRobot.kt b/feature/interests/src/androidTest/java/com/google/samples/apps/nowinandroid/interests/InterestsRobot.kt index dea004876..3cad8ec22 100644 --- a/feature/interests/src/androidTest/java/com/google/samples/apps/nowinandroid/interests/InterestsRobot.kt +++ b/feature/interests/src/androidTest/java/com/google/samples/apps/nowinandroid/interests/InterestsRobot.kt @@ -1,17 +1,17 @@ /* * Copyright 2022 The Android Open Source Project * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.google.samples.apps.nowinandroid.interests @@ -32,7 +32,8 @@ import com.google.samples.apps.nowinandroid.feature.interests.InterestsUiState import com.google.samples.apps.nowinandroid.feature.interests.R.string internal class InterestsRobot( - private val composeTestRule: AndroidComposeTestRule, ComponentActivity> + private val composeTestRule: AndroidComposeTestRule< + ActivityScenarioRule, ComponentActivity> ) { private val interestsLoading = getString(string.interests_loading) private val interestsEmptyHeader = getString(string.interests_empty_header) @@ -98,4 +99,4 @@ internal class InterestsRobot( private fun getString(@StringRes stringId: Int) = composeTestRule.activity.resources.getString(stringId) -} \ No newline at end of file +} diff --git a/feature/interests/src/androidTest/java/com/google/samples/apps/nowinandroid/interests/InterestsScreenTest.kt b/feature/interests/src/androidTest/java/com/google/samples/apps/nowinandroid/interests/InterestsScreenTest.kt index 6f3913f4a..0db29f970 100644 --- a/feature/interests/src/androidTest/java/com/google/samples/apps/nowinandroid/interests/InterestsScreenTest.kt +++ b/feature/interests/src/androidTest/java/com/google/samples/apps/nowinandroid/interests/InterestsScreenTest.kt @@ -75,7 +75,6 @@ class InterestsScreenTest { interestsTopicCardFollowButtonCountEquals(numberOfUnfollowedTopics) interestsTopicCardUnfollowButtonCountEquals(numberOfFollowedTopics) - } } @@ -119,7 +118,8 @@ class InterestsScreenTest { } private fun launchBookmarksRobot( - composeTestRule: AndroidComposeTestRule, ComponentActivity>, + composeTestRule: AndroidComposeTestRule< + ActivityScenarioRule, ComponentActivity>, uiState: InterestsUiState, tabIndex: Int, func: InterestsRobot.() -> Unit diff --git a/feature/settings/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialogRobot.kt b/feature/settings/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialogRobot.kt index c94f7b29b..a8f895815 100644 --- a/feature/settings/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialogRobot.kt +++ b/feature/settings/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialogRobot.kt @@ -1,17 +1,17 @@ /* * Copyright 2022 The Android Open Source Project * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.google.samples.apps.nowinandroid.feature.settings @@ -24,7 +24,8 @@ import androidx.compose.ui.test.onNodeWithText import androidx.test.ext.junit.rules.ActivityScenarioRule internal class SettingsDialogRobot( - private val composeTestRule: AndroidComposeTestRule, ComponentActivity> + private val composeTestRule: AndroidComposeTestRule< + ActivityScenarioRule, ComponentActivity> ) { fun setContent(settingsUiState: SettingsUiState) { composeTestRule.setContent { @@ -57,4 +58,4 @@ internal class SettingsDialogRobot( fun getString(@StringRes stringId: Int) = composeTestRule.activity.resources.getString(stringId) -} \ No newline at end of file +} diff --git a/feature/settings/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialogTest.kt b/feature/settings/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialogTest.kt index bf1af77dc..6870b2197 100644 --- a/feature/settings/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialogTest.kt +++ b/feature/settings/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/settings/SettingsDialogTest.kt @@ -82,7 +82,8 @@ class SettingsDialogTest { } private fun launchSettingsDialogRobot( - composeTestRule: AndroidComposeTestRule, ComponentActivity>, + composeTestRule: AndroidComposeTestRule< + ActivityScenarioRule, ComponentActivity>, settingsUiState: SettingsUiState, func: SettingsDialogRobot.() -> Unit ) = SettingsDialogRobot(composeTestRule).apply { diff --git a/feature/topic/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/topic/TopicRobot.kt b/feature/topic/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/topic/TopicRobot.kt index 06fc4d43b..b4ba08927 100644 --- a/feature/topic/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/topic/TopicRobot.kt +++ b/feature/topic/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/topic/TopicRobot.kt @@ -1,17 +1,17 @@ /* * Copyright 2022 The Android Open Source Project * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.google.samples.apps.nowinandroid.feature.topic @@ -29,7 +29,8 @@ import com.google.samples.apps.nowinandroid.core.domain.model.FollowableTopic import com.google.samples.apps.nowinandroid.core.model.data.NewsResource internal class TopicRobot( - private val composeTestRule: AndroidComposeTestRule, ComponentActivity> + private val composeTestRule: AndroidComposeTestRule< + ActivityScenarioRule, ComponentActivity> ) { private val topicLoading = composeTestRule.activity.resources.getString(R.string.topic_loading) @@ -67,4 +68,4 @@ internal class TopicRobot( .onFirst() .performScrollToNode(hasText(newsResource.title)) } -} \ No newline at end of file +} diff --git a/feature/topic/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/topic/TopicScreenTest.kt b/feature/topic/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/topic/TopicScreenTest.kt index 1df807635..d37efb4b9 100644 --- a/feature/topic/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/topic/TopicScreenTest.kt +++ b/feature/topic/src/androidTest/java/com/google/samples/apps/nowinandroid/feature/topic/TopicScreenTest.kt @@ -103,7 +103,8 @@ class TopicScreenTest { } private fun launchTopicRobot( - composeTestRule: AndroidComposeTestRule, ComponentActivity>, + composeTestRule: AndroidComposeTestRule< + ActivityScenarioRule, ComponentActivity>, topicUiState: TopicUiState, newsUiState: NewsUiState, func: TopicRobot.() -> Unit