Skip to content

Commit 1017900

Browse files
committed
Addressed review comments
1 parent 70b4931 commit 1017900

File tree

4 files changed

+16
-25
lines changed

4 files changed

+16
-25
lines changed

acyclic-visitor/src/test/java/com/iluwatar/acyclicvisitor/ConfigureForUnixVisitorTest.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,19 @@
2525
import static org.assertj.core.api.Assertions.assertThat;
2626
import static org.assertj.core.groups.Tuple.tuple;
2727
import static uk.org.lidalia.slf4jext.Level.INFO;
28-
import static org.mockito.Mockito.mock;
2928

30-
import uk.org.lidalia.slf4jtest.TestLogger;
31-
import uk.org.lidalia.slf4jtest.TestLoggerFactory;
29+
import org.junit.jupiter.api.AfterEach;
3230
import org.junit.jupiter.api.Test;
3331

34-
import com.iluwatar.acyclicvisitor.ConfigureForUnixVisitor;
35-
import com.iluwatar.acyclicvisitor.Hayes;
36-
import com.iluwatar.acyclicvisitor.HayesVisitor;
37-
import com.iluwatar.acyclicvisitor.Zoom;
38-
import com.iluwatar.acyclicvisitor.ZoomVisitor;
39-
40-
import org.junit.jupiter.api.AfterEach;
41-
import org.junit.jupiter.api.Assertions;
32+
import uk.org.lidalia.slf4jtest.TestLogger;
33+
import uk.org.lidalia.slf4jtest.TestLoggerFactory;
4234

4335
/**
4436
* ConfigureForUnixVisitor test class
4537
*/
4638
public class ConfigureForUnixVisitorTest {
4739

48-
private TestLogger logger = TestLoggerFactory.getTestLogger(ConfigureForUnixVisitor.class);
40+
private static final TestLogger LOGGER = TestLoggerFactory.getTestLogger(ConfigureForUnixVisitor.class);
4941

5042
@AfterEach
5143
public void clearLoggers() {
@@ -59,7 +51,7 @@ public void testVisitForZoom() {
5951

6052
conUnix.visit(zoom);
6153

62-
assertThat(logger.getLoggingEvents()).extracting("level", "message").contains(
54+
assertThat(LOGGER.getLoggingEvents()).extracting("level", "message").contains(
6355
tuple(INFO, zoom + " used with Unix configurator."));
6456
}
6557
}

data-mapper/src/test/java/com/iluwatar/datamapper/DataMapperTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,24 @@ public void testFirstDataMapper() {
4444
final StudentDataMapper mapper = new StudentDataMapperImpl();
4545

4646
/* Create new student */
47-
Student student = new Student(1, "Adam", 'A');
47+
int studentId = 1;
48+
Student student = new Student(studentId, "Adam", 'A');
4849

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

5253
/* Check if student is added in db */
53-
assertEquals(student.getStudentId(), mapper.find(student.getStudentId()).get().getStudentId());
54+
assertEquals(studentId, mapper.find(student.getStudentId()).get().getStudentId());
5455

5556
/* Update existing student object */
56-
student = new Student(student.getStudentId(), "AdamUpdated", 'A');
57+
String updatedName = "AdamUpdated";
58+
student = new Student(student.getStudentId(), updatedName, 'A');
5759

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

6163
/* Check if student is updated in db */
62-
assertEquals("AdamUpdated", mapper.find(student.getStudentId()).get().getName());
64+
assertEquals(updatedName, mapper.find(student.getStudentId()).get().getName());
6365

6466
/* Delete student in db */
6567
mapper.delete(student);

monostate/src/main/java/com/iluwatar/monostate/LoadBalancer.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ public class LoadBalancer {
3939

4040
static {
4141
int id = 0;
42-
SERVERS.add(new Server("localhost", 8081, ++id));
43-
SERVERS.add(new Server("localhost", 8080, ++id));
44-
SERVERS.add(new Server("localhost", 8082, ++id));
45-
SERVERS.add(new Server("localhost", 8083, ++id));
46-
SERVERS.add(new Server("localhost", 8084, ++id));
42+
for (int port : new int[] {8080, 8081, 8082, 8083, 8084}) {
43+
SERVERS.add(new Server("localhost", port, ++id));
44+
}
4745
}
4846

4947
/**

monostate/src/test/java/com/iluwatar/monostate/LoadBalancerTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
*/
2323
package com.iluwatar.monostate;
2424

25-
import org.junit.jupiter.api.Test;
26-
2725
import static org.junit.jupiter.api.Assertions.assertEquals;
28-
import static org.junit.jupiter.api.Assertions.assertTrue;
2926
import static org.mockito.Matchers.any;
3027
import static org.mockito.Mockito.doNothing;
3128
import static org.mockito.Mockito.mock;
@@ -35,6 +32,8 @@
3532
import static org.mockito.Mockito.verifyZeroInteractions;
3633
import static org.mockito.Mockito.when;
3734

35+
import org.junit.jupiter.api.Test;
36+
3837
/**
3938
* Date: 12/21/15 - 12:26 PM
4039
*

0 commit comments

Comments
 (0)