Skip to content

Commit b8e258c

Browse files
authored
Merge pull request eugenp#613 from sivabalachandran/master
Fixed unit test naming convention.
2 parents 7d5b613 + f7995e4 commit b8e258c

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
@@ -31,32 +31,40 @@ public void setup() {
3131
}
3232

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

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

4350
@Test
44-
public void givenServiceTimeoutEqualTo10000_andDefaultSettings_thenExpectHRE() throws InterruptedException {
51+
public void givenSvcTimeoutOf10000AndDefaultSettings__whenExecuted_thenExpectHRE() throws InterruptedException {
4552
exception.expect(HystrixRuntimeException.class);
4653
new RemoteServiceTestCommand(config, new RemoteServiceTestSimulator(10_000)).execute();
4754
}
4855

4956
@Test
50-
public void givenServiceTimeoutEqualTo500_andExecutionTimeoutEqualTo10000_thenReturnSuccess()
57+
public void givenSvcTimeoutOf5000AndExecTimeoutOf10000__whenExecuted_thenReturnSuccess()
5158
throws InterruptedException {
5259
commandProperties.withExecutionTimeoutInMilliseconds(10_000);
5360
config.andCommandPropertiesDefaults(commandProperties);
61+
5462
assertThat(new RemoteServiceTestCommand(config, new RemoteServiceTestSimulator(500)).execute(),
5563
equalTo("Success"));
5664
}
5765

5866
@Test
59-
public void givenServiceTimeoutEqualTo15000_andExecutionTimeoutEqualTo5000_thenExpectHRE()
67+
public void givenSvcTimeoutOf15000AndExecTimeoutOf5000__whenExecuted_thenExpectHRE()
6068
throws InterruptedException {
6169
exception.expect(HystrixRuntimeException.class);
6270
commandProperties.withExecutionTimeoutInMilliseconds(5_000);
@@ -65,20 +73,22 @@ public void givenServiceTimeoutEqualTo15000_andExecutionTimeoutEqualTo5000_thenE
6573
}
6674

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

8089
@Test
81-
public void givenCircuitBreakerSetup_thenReturnSuccess() throws InterruptedException {
90+
public void givenCircuitBreakerSetup__whenRemoteSvcCmdExecuted_thenReturnSuccess()
91+
throws InterruptedException {
8292

8393
commandProperties.withExecutionTimeoutInMilliseconds(1000);
8494

0 commit comments

Comments
 (0)