Skip to content

Commit cfeaa4e

Browse files
author
sbalachandran
committed
Fixed unit test naming convention.
1 parent 6401669 commit cfeaa4e

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

hystrix/src/test/java/com/baeldung/hystrix/HystrixTimeoutTest.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,40 @@ public void setup() {
3232
}
3333

3434
@Test
35-
public void givenInputBob_andDefaultSettings_thenReturnHelloBob(){
35+
public void givenInputBobAndDefaultSettings_whenExecuted_thenReturnHelloBob(){
3636
assertThat(new CommandHelloWorld("Bob").execute(), equalTo("Hello Bob!"));
3737
}
3838

3939
@Test
40-
public void givenServiceTimeoutEqualTo100_andDefaultSettings_thenReturnSuccess() throws InterruptedException {
41-
assertThat(new RemoteServiceTestCommand(config, new RemoteServiceTestSimulator(100)).execute(), equalTo("Success"));
40+
public void givenSvcTimeoutOf100AndDefaultSettings_whenExecuted_thenReturnSuccess()
41+
throws InterruptedException {
42+
43+
HystrixCommand.Setter config = HystrixCommand
44+
.Setter
45+
.withGroupKey(HystrixCommandGroupKey.Factory.asKey("RemoteServiceGroup1"));
46+
47+
assertThat(new RemoteServiceTestCommand(config, new RemoteServiceTestSimulator(100)).execute(),
48+
equalTo("Success"));
4249
}
4350

4451
@Test
45-
public void givenServiceTimeoutEqualTo10000_andDefaultSettings_thenExpectHRE() throws InterruptedException {
52+
public void givenSvcTimeoutOf10000AndDefaultSettings__whenExecuted_thenExpectHRE() throws InterruptedException {
4653
exception.expect(HystrixRuntimeException.class);
4754
new RemoteServiceTestCommand(config, new RemoteServiceTestSimulator(10_000)).execute();
4855
}
4956

5057
@Test
51-
public void givenServiceTimeoutEqualTo5000_andExecutionTimeoutEqualTo10000_thenReturnSuccess()
58+
public void givenSvcTimeoutOf5000AndExecTimeoutOf10000__whenExecuted_thenReturnSuccess()
5259
throws InterruptedException {
5360
commandProperties.withExecutionTimeoutInMilliseconds(10_000);
5461
config.andCommandPropertiesDefaults(commandProperties);
62+
5563
assertThat(new RemoteServiceTestCommand(config, new RemoteServiceTestSimulator(500)).execute(),
5664
equalTo("Success"));
5765
}
5866

5967
@Test
60-
public void givenServiceTimeoutEqualTo15000_andExecutionTimeoutEqualTo5000_thenExpectHRE()
68+
public void givenSvcTimeoutOf15000AndExecTimeoutOf5000__whenExecuted_thenExpectHRE()
6169
throws InterruptedException {
6270
exception.expect(HystrixRuntimeException.class);
6371
commandProperties.withExecutionTimeoutInMilliseconds(5_000);
@@ -66,20 +74,22 @@ public void givenServiceTimeoutEqualTo15000_andExecutionTimeoutEqualTo5000_thenE
6674
}
6775

6876
@Test
69-
public void givenServiceTimeoutEqual_andExecutionTimeout_andThreadPool_thenReturnSuccess()
77+
public void givenSvcTimeoutOf500AndExecTimeoutOf10000AndThreadPool__whenExecuted_thenReturnSuccess()
7078
throws InterruptedException {
7179
commandProperties.withExecutionTimeoutInMilliseconds(10_000);
7280
config.andCommandPropertiesDefaults(commandProperties);
7381
config.andThreadPoolPropertiesDefaults(HystrixThreadPoolProperties.Setter()
7482
.withMaxQueueSize(10)
7583
.withCoreSize(3)
7684
.withQueueSizeRejectionThreshold(10));
85+
7786
assertThat(new RemoteServiceTestCommand(config, new RemoteServiceTestSimulator(500)).execute(),
7887
equalTo("Success"));
7988
}
8089

8190
@Test
82-
public void givenCircuitBreakerSetup_thenReturnSuccess() throws InterruptedException {
91+
public void givenCircuitBreakerSetup__whenRemoteSvcCmdExecuted_thenReturnSuccess()
92+
throws InterruptedException {
8393

8494
commandProperties.withExecutionTimeoutInMilliseconds(1000);
8595

0 commit comments

Comments
 (0)