Skip to content

Commit

Permalink
codacy fix trial 2
Browse files Browse the repository at this point in the history
  • Loading branch information
RainbowSea0322 committed Dec 1, 2023
1 parent ef17e2a commit 0844650
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.view.ViewParent;

import androidx.test.espresso.ViewInteraction;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
Expand Down Expand Up @@ -54,7 +55,7 @@ public void bookCancelStudyRoomSuccessTest() {
ViewInteraction ic = onView(
allOf(withText("Sign in"),
childAtPosition(
allOf(withId(R.id.sign_in_button),
allOf(ViewMatchers.withId(R.id.sign_in_button),
childAtPosition(
withClassName(is("androidx.constraintlayout.widget.ConstraintLayout")),
0)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -51,7 +50,7 @@ public void bookStudyRoomFailure2ATest() {
ViewInteraction ic = onView(
allOf(withText("Sign in"),
childAtPosition(
Matchers(ViewMatchers(R.id.sign_in_button),
allOf(ViewMatchers.withId(R.id.sign_in_button),
childAtPosition(
withClassName(is("androidx.constraintlayout.widget.ConstraintLayout")),
0)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeMatcher;
import org.hamcrest.core.IsInstanceOf;
import org.junit.Rule;
Expand All @@ -56,7 +55,7 @@ public void bookCancelFailure4ATest() {
ViewInteraction ic = onView(
allOf(withText("Sign in"),
childAtPosition(
Matchers.allOf(ViewMatchers.withId(R.id.sign_in_button),
allOf(ViewMatchers.withId(R.id.sign_in_button),
childAtPosition(
withClassName(is("androidx.constraintlayout.widget.ConstraintLayout")),
0)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -55,7 +54,7 @@ public void confirmAttendanceFailure3ATest() {
ViewInteraction ic = onView(
allOf(withText("Sign in"),
childAtPosition(
Matchers.allOf(ViewMatchers.withId(R.id.sign_in_button),
allOf(ViewMatchers.withId(R.id.sign_in_button),
childAtPosition(
withClassName(is("androidx.constraintlayout.widget.ConstraintLayout")),
0)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeMatcher;
import org.hamcrest.core.IsInstanceOf;
import org.junit.Rule;
Expand All @@ -56,7 +55,7 @@ public void confirmAttendanceSuccessTest() {
ViewInteraction ic = onView(
allOf(withText("Sign in"),
childAtPosition(
Matchers.allOf(ViewMatchers.withId(R.id.sign_in_button),
allOf(ViewMatchers.withId(R.id.sign_in_button),
childAtPosition(
withClassName(is("androidx.constraintlayout.widget.ConstraintLayout")),
0)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -47,7 +46,7 @@ public void filterStudyRoomsFailure8ATest() {
ViewInteraction ic = onView(
allOf(withText("Sign in"),
childAtPosition(
Matchers.allOf(ViewMatchers.withId(R.id.sign_in_button),
allOf(ViewMatchers.withId(R.id.sign_in_button),
childAtPosition(
withClassName(is("androidx.constraintlayout.widget.ConstraintLayout")),
0)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeMatcher;
import org.hamcrest.core.IsInstanceOf;
import org.junit.Rule;
Expand All @@ -59,7 +58,7 @@ public void filterStudyRoomsFailure8BTest() {
ViewInteraction ic = onView(
allOf(withText("Sign in"),
childAtPosition(
Matchers.allOf(ViewMatchers.withId(R.id.sign_in_button),
allOf(ViewMatchers.withId(R.id.sign_in_button),
childAtPosition(
withClassName(is("androidx.constraintlayout.widget.ConstraintLayout")),
0)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeMatcher;
import org.hamcrest.core.IsInstanceOf;
import org.junit.Rule;
Expand All @@ -61,7 +60,7 @@ public void filterStudyRoomsSuccessTest() {
ViewInteraction ic = onView(
allOf(withText("Sign in"),
childAtPosition(
Matchers.allOf(ViewMatchers.withId(R.id.sign_in_button),
allOf(ViewMatchers.withId(R.id.sign_in_button),
childAtPosition(
withClassName(is("androidx.constraintlayout.widget.ConstraintLayout")),
0)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeMatcher;
import org.hamcrest.core.IsInstanceOf;
import org.junit.Rule;
Expand All @@ -57,7 +56,7 @@ public void attendanceConfirmationIn3ClicksTest() {
ViewInteraction ic = onView(
allOf(withText("Sign in"),
childAtPosition(
Matchers.allOf(ViewMatchers.withId(R.id.sign_in_button),
allOf(ViewMatchers.withId(R.id.sign_in_button),
childAtPosition(
withClassName(is("androidx.constraintlayout.widget.ConstraintLayout")),
0)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeMatcher;
import org.hamcrest.core.IsInstanceOf;
import org.junit.Rule;
Expand All @@ -61,7 +60,7 @@ public void filterStudyRoomsSuccessTest() {
ViewInteraction ic = onView(
allOf(withText("Sign in"),
childAtPosition(
Matchers.allOf(ViewMatchers.withId(R.id.sign_in_button),
allOf(ViewMatchers.withId(R.id.sign_in_button),
childAtPosition(
withClassName(is("androidx.constraintlayout.widget.ConstraintLayout")),
0)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class SearchActivity extends AppCompatActivity implements RecyclerViewInt
"IRC", "LASR", "LIFE", "LSK", "MATH", "MATX", "MCLD", "MCML", "ORCH", "OSB1", "PHRM", "PCN",
"SCRF", "SOWK", "SPPH", "SWNG", "UCEN", "WESB"};

private final String[] allBuildingNames = allBuildingCodes;
private final ArrayList<String> informalLearningSpaceBuildingCodes = new ArrayList<>();
private final ArrayList<String> informalLearningSpaceBuildingNames = new ArrayList<>();
private final ArrayList<String> lectureHallBuildingCodes = new ArrayList<>();
Expand All @@ -50,7 +49,6 @@ public class SearchActivity extends AppCompatActivity implements RecyclerViewInt

private final ArrayList<String> studyRoomBuildingNames = new ArrayList<>();
private ArrayList<String> showingBuildingCodes;
private ArrayList<String> showingBuildingNames;
private ArrayList<String> showingBuildingList;
private String requestBuildingType = "";
private TextView guideText;
Expand Down Expand Up @@ -151,39 +149,37 @@ private void setButtonListener(Button button, String spaceType) {
switch (spaceType) {
case "":
showingBuildingCodes = new ArrayList<>();
showingBuildingNames = new ArrayList<>();

informalLearningSpaceButton.setBackgroundResource(R.drawable.bottom_button);
lectureHallButton.setBackgroundResource(R.drawable.top_button);
studyRoomButton.setBackgroundResource(R.drawable.top_button);
break;
case "ils":
showingBuildingCodes = informalLearningSpaceBuildingCodes;
showingBuildingNames = informalLearningSpaceBuildingNames;
// setting button background
informalLearningSpaceButton.setBackgroundResource(R.drawable.bottom_button);
lectureHallButton.setBackgroundResource(R.drawable.top_button);
studyRoomButton.setBackgroundResource(R.drawable.top_button);
break;
case "lecturehalls":
showingBuildingCodes = lectureHallBuildingCodes;
showingBuildingNames = lectureHallBuildingNames;
// setting button background
informalLearningSpaceButton.setBackgroundResource(R.drawable.top_button);
lectureHallButton.setBackgroundResource(R.drawable.bottom_button);
studyRoomButton.setBackgroundResource(R.drawable.top_button);
break;
case "studyrooms":
showingBuildingCodes = studyRoomBuildingCodes;
showingBuildingNames = studyRoomBuildingNames;
// setting button background
informalLearningSpaceButton.setBackgroundResource(R.drawable.top_button);
lectureHallButton.setBackgroundResource(R.drawable.top_button);
studyRoomButton.setBackgroundResource(R.drawable.bottom_button);
break;
default:
showingBuildingCodes = new ArrayList<>(Arrays.asList(allBuildingCodes));
showingBuildingCodes = new ArrayList<>(Arrays.asList(allBuildingNames));
informalLearningSpaceButton.setBackgroundResource(R.drawable.top_button);
lectureHallButton.setBackgroundResource(R.drawable.top_button);
studyRoomButton.setBackgroundResource(R.drawable.top_button);
break;
}

Expand Down

0 comments on commit 0844650

Please sign in to comment.