Skip to content

Commit

Permalink
Some typos and smells provided by Sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
augustocristian committed Jan 1, 2025
1 parent 737ed98 commit 6335721
Showing 1 changed file with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@
import static java.lang.invoke.MethodHandles.lookup;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.*;
import static org.openqa.selenium.logging.LogType.BROWSER;
import static org.slf4j.LoggerFactory.getLogger;

class FullTeachingLoggedVideoSessionTests extends BaseLoggedTest {

final static Logger log = getLogger(lookup().lookupClass());
static final Logger log = getLogger(lookup().lookupClass());

public String courseName;
protected List<String> studentPassList;
Expand Down Expand Up @@ -90,21 +88,21 @@ void sessionTest(String mail, String password, String role) throws ElementNotFou
*/
private void initializeStudents(String pathData) throws IOException, URISyntaxException, NotLoggedException, ElementNotFoundException, InterruptedException {
log.info("Initializing students");
String users_data = loadStudentsData(pathData);
String usersData = loadStudentsData(pathData);
studentNameList = new ArrayList<>();
studentPassList = new ArrayList<>();
studentNamesList = new ArrayList<>();
studentBrowserUserList = new ArrayList<>();
String[] students_data = users_data.split(";");
String[] studentsData = usersData.split(";");

for (int i = 0; i < students_data.length; i++) {
String userid = students_data[i].split(":")[0];
for (int i = 0; i < studentsData.length; i++) {
String userid = studentsData[i].split(":")[0];
studentNameList.add(userid);
String user_password = students_data[i].split(":")[1];
studentPassList.add(user_password);
String STUDENT_BROWSER = students_data[i].split(":")[2];
BrowserUser studentD = setupBrowser(STUDENT_BROWSER, TJOB_NAME + "-" + TEST_NAME, userid, WAIT_SECONDS);
this.slowLogin(studentD, userid, user_password);
String userPassword = studentsData[i].split(":")[1];
studentPassList.add(userPassword);
String studentBrowser = studentsData[i].split(":")[2];
BrowserUser studentD = setupBrowser(studentBrowser, TJOB_NAME + "-" + TEST_NAME, userid, WAIT_SECONDS);
this.slowLogin(studentD, userid, userPassword);
studentNamesList.add(userid);
studentBrowserUserList.add(studentD);
}
Expand Down Expand Up @@ -133,8 +131,8 @@ private void createNewSession(String sessionName) throws ElementNotFoundExceptio
// Verify session creation
Wait.waitForPageLoaded(user.getDriver());
user.waitUntil(ExpectedConditions.numberOfElementsToBeMoreThan(SESSION_LIST_SESSION_ROW,3),"Incorrect number of sessions (never more than 2)");
List<String> session_titles = SessionNavigationUtilities.getFullSessionList(user.getDriver());
assertTrue(session_titles.contains(sessionName), "Session has not been created");
List<String> sessionTitles = SessionNavigationUtilities.getFullSessionList(user.getDriver());
assertTrue(sessionTitles.contains(sessionName), "Session has not been created");
}

private void introduceSessionDate(BrowserUser user, WebElement element) {
Expand Down Expand Up @@ -203,8 +201,8 @@ private String getCurrentTime() {
* This method navigates and joins the session, checking that it exist
*/
private void joinSession(String sessionName, BrowserUser usr) throws ElementNotFoundException {
List<String> session_titles = SessionNavigationUtilities.getFullSessionList(usr.getDriver());
assertTrue(session_titles.contains(sessionName), "Session has not been created");
List<String> sessionTitles = SessionNavigationUtilities.getFullSessionList(usr.getDriver());
assertTrue(sessionTitles.contains(sessionName), "Session has not been created");
WebElement session = SessionNavigationUtilities.getSession(usr.getDriver(), sessionName);
Click.element(usr.getDriver(), session.findElement(SESSION_LIST_SESSION_ACCESS));
}
Expand Down Expand Up @@ -254,7 +252,7 @@ private void leaveSession(BrowserUser usr) throws ElementNotFoundException {
* @param sessionName string with the session name
*/
private void deleteSession(String sessionName) throws ElementNotFoundException {
List<String> session_titles;
List<String> sessionTitles;
WebElement modal;
WebElement session;
session = SessionNavigationUtilities.getSession(user.getDriver(), sessionName);
Expand All @@ -263,8 +261,8 @@ private void deleteSession(String sessionName) throws ElementNotFoundException {
Click.element(user.getDriver(), modal.findElement(SESSION_LIST_EDIT_MODAL_DELETE_DIV).findElement(By.tagName("label")));
Click.element(user.getDriver(), modal.findElement(SESSION_LIST_EDIT_MODAL_DELETE_DIV).findElement(By.tagName("a")));
Wait.waitForPageLoaded(user.getDriver());//13 lines
session_titles = SessionNavigationUtilities.getFullSessionList(user.getDriver()); //7 lines
assertFalse(session_titles.contains(sessionName), "Session has not been deleted");
sessionTitles = SessionNavigationUtilities.getFullSessionList(user.getDriver()); //7 lines
assertFalse(sessionTitles.contains(sessionName), "Session has not been deleted");
}

public String loadStudentsData(String path) throws IOException {
Expand All @@ -277,6 +275,7 @@ public String loadStudentsData(String path) throws IOException {
key.append(line);
line = reader.readLine();
}
reader.close();
System.out.println(key);
return key.toString();
}
Expand Down

0 comments on commit 6335721

Please sign in to comment.