Skip to content

Commit 4cd8149

Browse files
1 parent 5afc32c commit 4cd8149

File tree

155 files changed

+273
-273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+273
-273
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void testVisitForHayes() {
7474

7575
@BeforeEach
7676
@AfterEach
77-
public void clearLoggers() {
77+
void clearLoggers() {
7878
TestLoggerFactory.clear();
7979
}
8080
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class ConfigureForUnixVisitorTest {
4444

4545
@BeforeEach
4646
@AfterEach
47-
public void clearLoggers() {
47+
void clearLoggers() {
4848
TestLoggerFactory.clear();
4949
}
5050

adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class AdapterPatternTest {
4848
* This method runs before the test execution and sets the bean objects in the beans Map.
4949
*/
5050
@BeforeEach
51-
public void setup() {
51+
void setup() {
5252
beans = new HashMap<>();
5353

5454
var fishingBoatAdapter = spy(new FishingBoatAdapter());

aggregator-microservices/aggregator-service/src/test/java/com/iluwatar/aggregator/microservices/AggregatorTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class AggregatorTest {
4848
private ProductInventoryClient inventoryClient;
4949

5050
@BeforeEach
51-
public void setup() {
51+
void setup() {
5252
MockitoAnnotations.openMocks(this);
5353
}
5454

api-gateway/api-gateway-service/src/test/java/com/iluwatar/api/gateway/ApiGatewayTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class ApiGatewayTest {
4848
private PriceClient priceClient;
4949

5050
@BeforeEach
51-
public void setup() {
51+
void setup() {
5252
MockitoAnnotations.openMocks(this);
5353
}
5454

business-delegate/src/test/java/com/iluwatar/business/delegate/BusinessDelegateTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class BusinessDelegateTest {
4949
* execution of every test.
5050
*/
5151
@BeforeEach
52-
public void setup() {
52+
void setup() {
5353
netflixService = spy(new NetflixService());
5454
youTubeService = spy(new YouTubeService());
5555

caching/src/test/java/com/iluwatar/caching/CachingTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CachingTest {
3939
* Setup of application test includes: initializing DB connection and cache size/capacity.
4040
*/
4141
@BeforeEach
42-
public void setUp() {
42+
void setUp() {
4343
// VirtualDB (instead of MongoDB) was used in running the JUnit tests
4444
// to avoid Maven compilation errors. Set flag to true to run the
4545
// tests with MongoDB (provided that MongoDB is installed and socket

callback/src/test/java/com/iluwatar/callback/CallbackTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* <p>
3535
* Could be done with mock objects as well where the call method call is verified.
3636
*/
37-
public class CallbackTest {
37+
class CallbackTest {
3838

3939
private Integer callingCount = 0;
4040

circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/AppTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/**
3535
* App Test showing usage of circuit breaker.
3636
*/
37-
public class AppTest {
37+
class AppTest {
3838

3939
private static final Logger LOGGER = LoggerFactory.getLogger(AppTest.class);
4040

@@ -60,7 +60,7 @@ public class AppTest {
6060
* and retry time period of 2 seconds.
6161
*/
6262
@BeforeEach
63-
public void setupCircuitBreakers() {
63+
void setupCircuitBreakers() {
6464
var delayedService = new DelayedRemoteService(System.nanoTime(), STARTUP_DELAY);
6565
//Set the circuit Breaker parameters
6666
delayedServiceCircuitBreaker = new DefaultCircuitBreaker(delayedService, 3000,
@@ -78,7 +78,7 @@ public void setupCircuitBreakers() {
7878
}
7979

8080
@Test
81-
public void testFailure_OpenStateTransition() {
81+
void testFailure_OpenStateTransition() {
8282
//Calling delayed service, which will be unhealthy till 4 seconds
8383
assertEquals("Delayed service is down", monitoringService.delayedServiceResponse());
8484
//As failure threshold is "1", the circuit breaker is changed to OPEN
@@ -93,7 +93,7 @@ public void testFailure_OpenStateTransition() {
9393
}
9494

9595
@Test
96-
public void testFailure_HalfOpenStateTransition() {
96+
void testFailure_HalfOpenStateTransition() {
9797
//Calling delayed service, which will be unhealthy till 4 seconds
9898
assertEquals("Delayed service is down", monitoringService.delayedServiceResponse());
9999
//As failure threshold is "1", the circuit breaker is changed to OPEN
@@ -112,7 +112,7 @@ public void testFailure_HalfOpenStateTransition() {
112112
}
113113

114114
@Test
115-
public void testRecovery_ClosedStateTransition() {
115+
void testRecovery_ClosedStateTransition() {
116116
//Calling delayed service, which will be unhealthy till 4 seconds
117117
assertEquals("Delayed service is down", monitoringService.delayedServiceResponse());
118118
//As failure threshold is "1", the circuit breaker is changed to OPEN

circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/DefaultCircuitBreakerTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/**
3232
* Circuit Breaker test
3333
*/
34-
public class DefaultCircuitBreakerTest {
34+
class DefaultCircuitBreakerTest {
3535

3636
//long timeout, int failureThreshold, long retryTimePeriod
3737
@Test

circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/DelayedRemoteServiceTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void testDefaultConstructor() throws RemoteServiceException {
5353
* @throws RemoteServiceException
5454
*/
5555
@Test
56-
public void testParameterizedConstructor() throws RemoteServiceException {
56+
void testParameterizedConstructor() throws RemoteServiceException {
5757
var obj = new DelayedRemoteService(System.nanoTime()-2000*1000*1000,1);
5858
assertEquals("Delayed service is working",obj.call());
5959
}

cloud-claim-check-pattern/call-usage-app/src/test/java/com/iluwatar/claimcheckpattern/consumer/callcostprocessor/functions/UsageCostProcessorFunctionTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
* Unit test for Function class.
5959
*/
6060
@ExtendWith(MockitoExtension.class)
61-
public class UsageCostProcessorFunctionTest {
61+
class UsageCostProcessorFunctionTest {
6262

6363
@Mock
6464
MessageHandlerUtility<UsageDetail> mockMessageHandlerUtilityForUsageADetail;
@@ -74,7 +74,7 @@ public class UsageCostProcessorFunctionTest {
7474
UsageCostProcessorFunction usageCostProcessorFunction;
7575

7676
@BeforeEach
77-
public void setUp() {
77+
void setUp() {
7878
var messageBodyUsageDetail = new MessageBody<UsageDetail>();
7979
var usageDetailsList = new ArrayList<UsageDetail>();
8080

@@ -122,7 +122,7 @@ public void setUp() {
122122
* Unit test for HttpTriggerJava method.
123123
*/
124124
@Test
125-
public void shouldTriggerHttpAzureFunctionJavaWithSubscriptionValidationEventType() throws Exception {
125+
void shouldTriggerHttpAzureFunctionJavaWithSubscriptionValidationEventType() throws Exception {
126126

127127
// Setup
128128
@SuppressWarnings("unchecked")
@@ -148,7 +148,7 @@ public HttpResponseMessage.Builder answer(InvocationOnMock invocation) {
148148
}
149149

150150
@Test
151-
public void shouldTriggerHttpAzureFunctionJavaWithUsageDetailEventType() throws Exception {
151+
void shouldTriggerHttpAzureFunctionJavaWithUsageDetailEventType() throws Exception {
152152
// Setup
153153
@SuppressWarnings("unchecked")
154154
final HttpRequestMessage<Optional<String>> req = mock(HttpRequestMessage.class);

cloud-claim-check-pattern/call-usage-app/src/test/java/com/iluwatar/claimcheckpattern/producer/calldetails/functions/UsageDetailPublisherFunctionTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
* Unit test for Function class.
5353
*/
5454
@ExtendWith(MockitoExtension.class)
55-
public class UsageDetailPublisherFunctionTest {
55+
class UsageDetailPublisherFunctionTest {
5656
@Mock
5757
MessageHandlerUtility<UsageDetail> mockMessageHandlerUtility;
5858
@Mock
@@ -65,7 +65,7 @@ public class UsageDetailPublisherFunctionTest {
6565
* Unit test for HttpTriggerJava method.
6666
*/
6767
@Test
68-
public void shouldTriggerHttpAzureFunctionJavaWithSubscriptionValidationEventType() throws Exception {
68+
void shouldTriggerHttpAzureFunctionJavaWithSubscriptionValidationEventType() throws Exception {
6969

7070
// Setup
7171
@SuppressWarnings("unchecked")
@@ -91,7 +91,7 @@ public HttpResponseMessage.Builder answer(InvocationOnMock invocation) {
9191
}
9292

9393
@Test
94-
public void shouldTriggerHttpAzureFunctionJavaWithUsageDetailEventType() throws Exception {
94+
void shouldTriggerHttpAzureFunctionJavaWithUsageDetailEventType() throws Exception {
9595

9696
// Setup
9797
@SuppressWarnings("unchecked")

cloud-claim-check-pattern/call-usage-app/src/test/java/com/iluwatar/claimcheckpattern/utility/EventHandlerUtilityTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import org.mockito.junit.jupiter.MockitoExtension;
4141

4242
@ExtendWith(MockitoExtension.class)
43-
public class EventHandlerUtilityTest {
43+
class EventHandlerUtilityTest {
4444

4545
@Mock
4646
EventGridPublisherClient<BinaryData> mockCustomEventClient;
@@ -49,7 +49,7 @@ public class EventHandlerUtilityTest {
4949
EventHandlerUtility<Message<UsageDetail>> eventHandlerUtility;
5050

5151
@BeforeEach
52-
public void setUp() {
52+
void setUp() {
5353

5454
System.setProperty("EventGridURL", "https://www.dummyEndpoint.com/api/events");
5555
System.setProperty("EventGridKey", "EventGridURL");

cloud-claim-check-pattern/call-usage-app/src/test/java/com/iluwatar/claimcheckpattern/utility/MessageHandlerUtilityTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import static org.mockito.Mockito.*;
4747

4848
@ExtendWith(MockitoExtension.class)
49-
public class MessageHandlerUtilityTest {
49+
class MessageHandlerUtilityTest {
5050
@Mock
5151
private BlobClient mockBlobClient;
5252

@@ -63,7 +63,7 @@ public class MessageHandlerUtilityTest {
6363
private MessageReference messageReference;
6464

6565
@BeforeEach
66-
public void setUp() {
66+
void setUp() {
6767
System.setProperty("BlobStorageConnectionString", "https://www.dummyEndpoint.com/api/blobs");
6868

6969
var messageBody = new MessageBody<UsageDetail>();

composite-view/src/test/java/com/iluwatar/compositeview/AppServletTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@
3939
and https://stackoverflow.com/questions/50211433/servlets-unit-testing
4040
*/
4141

42-
public class AppServletTest extends Mockito{
42+
class AppServletTest extends Mockito{
4343
private String msgPartOne = "<h1>This Server Doesn't Support";
4444
private String msgPartTwo = "Requests</h1>\n"
4545
+ "<h2>Use a GET request with boolean values for the following parameters<h2>\n"
4646
+ "<h3>'name'</h3>\n<h3>'bus'</h3>\n<h3>'sports'</h3>\n<h3>'sci'</h3>\n<h3>'world'</h3>";
4747
private String destination = "newsDisplay.jsp";
4848

4949
@Test
50-
public void testDoGet() throws Exception {
50+
void testDoGet() throws Exception {
5151
HttpServletRequest mockReq = Mockito.mock(HttpServletRequest.class);
5252
HttpServletResponse mockResp = Mockito.mock(HttpServletResponse.class);
5353
RequestDispatcher mockDispatcher = Mockito.mock(RequestDispatcher.class);
@@ -64,7 +64,7 @@ public void testDoGet() throws Exception {
6464
}
6565

6666
@Test
67-
public void testDoPost() throws Exception {
67+
void testDoPost() throws Exception {
6868
HttpServletRequest mockReq = Mockito.mock(HttpServletRequest.class);
6969
HttpServletResponse mockResp = Mockito.mock(HttpServletResponse.class);
7070
StringWriter stringWriter = new StringWriter();
@@ -78,7 +78,7 @@ public void testDoPost() throws Exception {
7878
}
7979

8080
@Test
81-
public void testDoPut() throws Exception {
81+
void testDoPut() throws Exception {
8282
HttpServletRequest mockReq = Mockito.mock(HttpServletRequest.class);
8383
HttpServletResponse mockResp = Mockito.mock(HttpServletResponse.class);
8484
StringWriter stringWriter = new StringWriter();
@@ -92,7 +92,7 @@ public void testDoPut() throws Exception {
9292
}
9393

9494
@Test
95-
public void testDoDelete() throws Exception {
95+
void testDoDelete() throws Exception {
9696
HttpServletRequest mockReq = Mockito.mock(HttpServletRequest.class);
9797
HttpServletResponse mockResp = Mockito.mock(HttpServletResponse.class);
9898
StringWriter stringWriter = new StringWriter();

composite-view/src/test/java/com/iluwatar/compositeview/JavaBeansTest.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030

3131
import static org.junit.Assert.*;
3232

33-
public class JavaBeansTest {
33+
class JavaBeansTest {
3434
@Test
35-
public void testDefaultConstructor() {
35+
void testDefaultConstructor() {
3636
ClientPropertiesBean newBean = new ClientPropertiesBean();
3737
assertEquals("DEFAULT_NAME", newBean.getName());
3838
assertTrue(newBean.isBusinessInterest());
@@ -43,47 +43,47 @@ public void testDefaultConstructor() {
4343
}
4444

4545
@Test
46-
public void testNameGetterSetter() {
46+
void testNameGetterSetter() {
4747
ClientPropertiesBean newBean = new ClientPropertiesBean();
4848
assertEquals("DEFAULT_NAME", newBean.getName());
4949
newBean.setName("TEST_NAME_ONE");
5050
assertEquals("TEST_NAME_ONE", newBean.getName());
5151
}
5252

5353
@Test
54-
public void testBusinessSetterGetter() {
54+
void testBusinessSetterGetter() {
5555
ClientPropertiesBean newBean = new ClientPropertiesBean();
5656
assertTrue(newBean.isBusinessInterest());
5757
newBean.setBusinessInterest(false);
5858
assertFalse(newBean.isBusinessInterest());
5959
}
6060

6161
@Test
62-
public void testScienceSetterGetter() {
62+
void testScienceSetterGetter() {
6363
ClientPropertiesBean newBean = new ClientPropertiesBean();
6464
assertTrue(newBean.isScienceNewsInterest());
6565
newBean.setScienceNewsInterest(false);
6666
assertFalse(newBean.isScienceNewsInterest());
6767
}
6868

6969
@Test
70-
public void testSportsSetterGetter() {
70+
void testSportsSetterGetter() {
7171
ClientPropertiesBean newBean = new ClientPropertiesBean();
7272
assertTrue(newBean.isSportsInterest());
7373
newBean.setSportsInterest(false);
7474
assertFalse(newBean.isSportsInterest());
7575
}
7676

7777
@Test
78-
public void testWorldSetterGetter() {
78+
void testWorldSetterGetter() {
7979
ClientPropertiesBean newBean = new ClientPropertiesBean();
8080
assertTrue(newBean.isWorldNewsInterest());
8181
newBean.setWorldNewsInterest(false);
8282
assertFalse(newBean.isWorldNewsInterest());
8383
}
8484

8585
@Test
86-
public void testRequestConstructor(){
86+
void testRequestConstructor(){
8787
HttpServletRequest mockReq = Mockito.mock(HttpServletRequest.class);
8888
ClientPropertiesBean newBean = new ClientPropertiesBean((mockReq));
8989
assertEquals("DEFAULT_NAME", newBean.getName());

dao/src/test/java/com/iluwatar/dao/DbCustomerDaoTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ void createSchema() throws SQLException {
7070
* Represents the scenario where DB connectivity is present.
7171
*/
7272
@Nested
73-
public class ConnectionSuccess {
73+
class ConnectionSuccess {
7474

7575
/**
7676
* Setup for connection success scenario.
7777
*
7878
* @throws Exception if any error occurs.
7979
*/
8080
@BeforeEach
81-
public void setUp() throws Exception {
81+
void setUp() throws Exception {
8282
var dataSource = new JdbcDataSource();
8383
dataSource.setURL(DB_URL);
8484
dao = new DbCustomerDao(dataSource);
@@ -191,7 +191,7 @@ class ConnectivityIssue {
191191
* @throws SQLException if any error occurs.
192192
*/
193193
@BeforeEach
194-
public void setUp() throws SQLException {
194+
void setUp() throws SQLException {
195195
dao = new DbCustomerDao(mockedDatasource());
196196
}
197197

flux/src/test/java/com/iluwatar/flux/action/ContentTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*
3535
* @author Jeroen Meulemeester
3636
*/
37-
public class ContentTest {
37+
class ContentTest {
3838

3939
@Test
4040
void testToString() {

flux/src/test/java/com/iluwatar/flux/action/MenuItemTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*
3535
* @author Jeroen Meulemeester
3636
*/
37-
public class MenuItemTest {
37+
class MenuItemTest {
3838

3939
@Test
4040
void testToString() {

0 commit comments

Comments
 (0)