Java 11 migration: patterns (remaining b-c) (#1081)
* Moves business-delegate pattern to java 11 * Moves bytecode pattern to java 11 * Moves caching pattern to java 11 * Moves callback pattern to java 11 * Moves chain pattern to java 11 * Moves circuit-breaker pattern to java 11 * Moves collection-pipeline pattern to java 11 * Moves command pattern to java 11 * Moves commander pattern to java 11 * Moves composite pattern to java 11 * Corrects test cases
This commit is contained in:
committed by
Ilkka Seppälä
parent
6ef840f3cf
commit
33ea7335b1
@ -24,12 +24,11 @@
|
||||
package com.iluwatar.circuitbreaker;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* Monitoring Service test
|
||||
*
|
||||
*/
|
||||
public class MonitoringServiceTest {
|
||||
|
||||
@ -40,24 +39,24 @@ public class MonitoringServiceTest {
|
||||
var response = monitoringService.localResourceResponse();
|
||||
assertEquals(response, "Local Service is working");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRemoteResponse() {
|
||||
var monitoringService = new MonitoringService();
|
||||
var circuitBreaker = new CircuitBreaker(1,1,100);
|
||||
var circuitBreaker = new CircuitBreaker(1, 1, 100);
|
||||
//Set time in past to make the server work
|
||||
var serverStartTime = System.nanoTime() / 10;
|
||||
var response = monitoringService.remoteResourceResponse(circuitBreaker, serverStartTime);
|
||||
assertEquals(response, "Delayed service is working");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRemoteResponse2() {
|
||||
MonitoringService monitoringService = new MonitoringService();
|
||||
CircuitBreaker circuitBreaker = new CircuitBreaker(1,1,100);
|
||||
var monitoringService = new MonitoringService();
|
||||
var circuitBreaker = new CircuitBreaker(1, 1, 100);
|
||||
//Set time as current time as initially server fails
|
||||
long serverStartTime = System.nanoTime();
|
||||
String response = monitoringService.remoteResourceResponse(circuitBreaker, serverStartTime);
|
||||
var serverStartTime = System.nanoTime();
|
||||
var response = monitoringService.remoteResourceResponse(circuitBreaker, serverStartTime);
|
||||
assertEquals(response, "Remote service not responding");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user