Addressed review comments

This commit is contained in:
npathai 2018-10-21 17:19:41 +05:30
parent 70b4931ab8
commit 10179007e8
4 changed files with 16 additions and 25 deletions

View File

@ -25,27 +25,19 @@ package com.iluwatar.acyclicvisitor;
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 org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import uk.org.lidalia.slf4jtest.TestLogger;
import uk.org.lidalia.slf4jtest.TestLoggerFactory;
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;
/**
* 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() {
@ -59,7 +51,7 @@ public class ConfigureForUnixVisitorTest {
conUnix.visit(zoom);
assertThat(logger.getLoggingEvents()).extracting("level", "message").contains(
assertThat(LOGGER.getLoggingEvents()).extracting("level", "message").contains(
tuple(INFO, zoom + " used with Unix configurator."));
}
}

View File

@ -44,22 +44,24 @@ public class DataMapperTest {
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);

View File

@ -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));
}
}
/**

View File

@ -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;
@ -35,6 +32,8 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
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
*