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

Minor refactorings and code style changes #807

Merged
merged 5 commits into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Addressed review comments
  • Loading branch information
npathai committed Oct 21, 2018
commit 10179007e857604f9d59dea8f49159a1640db290
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,19 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.groups.Tuple.tuple;
import static uk.org.lidalia.slf4jext.Level.INFO;
import static org.mockito.Mockito.mock;

import uk.org.lidalia.slf4jtest.TestLogger;
import uk.org.lidalia.slf4jtest.TestLoggerFactory;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;

import com.iluwatar.acyclicvisitor.ConfigureForUnixVisitor;
import com.iluwatar.acyclicvisitor.Hayes;
import com.iluwatar.acyclicvisitor.HayesVisitor;
import com.iluwatar.acyclicvisitor.Zoom;
import com.iluwatar.acyclicvisitor.ZoomVisitor;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import uk.org.lidalia.slf4jtest.TestLogger;
import uk.org.lidalia.slf4jtest.TestLoggerFactory;

/**
* ConfigureForUnixVisitor test class
*/
public class ConfigureForUnixVisitorTest {

private TestLogger logger = TestLoggerFactory.getTestLogger(ConfigureForUnixVisitor.class);
private static final TestLogger LOGGER = TestLoggerFactory.getTestLogger(ConfigureForUnixVisitor.class);

@AfterEach
public void clearLoggers() {
Expand All @@ -59,7 +51,7 @@ public void testVisitForZoom() {

conUnix.visit(zoom);

assertThat(logger.getLoggingEvents()).extracting("level", "message").contains(
assertThat(LOGGER.getLoggingEvents()).extracting("level", "message").contains(
tuple(INFO, zoom + " used with Unix configurator."));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,24 @@ public void testFirstDataMapper() {
final StudentDataMapper mapper = new StudentDataMapperImpl();

/* Create new student */
Student student = new Student(1, "Adam", 'A');
int studentId = 1;
Student student = new Student(studentId, "Adam", 'A');

/* Add student in respectibe db */
mapper.insert(student);

/* Check if student is added in db */
assertEquals(student.getStudentId(), mapper.find(student.getStudentId()).get().getStudentId());
assertEquals(studentId, mapper.find(student.getStudentId()).get().getStudentId());

/* Update existing student object */
student = new Student(student.getStudentId(), "AdamUpdated", 'A');
String updatedName = "AdamUpdated";
student = new Student(student.getStudentId(), updatedName, 'A');

/* Update student in respectibe db */
mapper.update(student);

/* Check if student is updated in db */
assertEquals("AdamUpdated", mapper.find(student.getStudentId()).get().getName());
assertEquals(updatedName, mapper.find(student.getStudentId()).get().getName());

/* Delete student in db */
mapper.delete(student);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ public class LoadBalancer {

static {
int id = 0;
SERVERS.add(new Server("localhost", 8081, ++id));
SERVERS.add(new Server("localhost", 8080, ++id));
SERVERS.add(new Server("localhost", 8082, ++id));
SERVERS.add(new Server("localhost", 8083, ++id));
SERVERS.add(new Server("localhost", 8084, ++id));
for (int port : new int[] {8080, 8081, 8082, 8083, 8084}) {
SERVERS.add(new Server("localhost", port, ++id));
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
*/
package com.iluwatar.monostate;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
Expand All @@ -35,6 +32,8 @@
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;

import org.junit.jupiter.api.Test;

/**
* Date: 12/21/15 - 12:26 PM
*
Expand Down