Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/test/java/io/lettuce/core/TimeoutOptionsUnitTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ void defaultConnectionTimeout() {

@Test
void fixedConnectionTimeout() {
final long MINUTES = 1;
final long MINUTE_IN_NANOS = TimeUnit.MINUTES.toNanos(MINUTES);

TimeoutOptions timeoutOptions = TimeoutOptions.enabled(Duration.ofMinutes(1));
TimeoutOptions timeoutOptions = TimeoutOptions.enabled(Duration.ofMinutes(MINUTES));

TimeoutSource source = timeoutOptions.getSource();
assertThat(timeoutOptions.isTimeoutCommands()).isTrue();
assertThat(timeoutOptions.isApplyConnectionTimeout()).isFalse();
assertThat(source.getTimeout(null)).isEqualTo(TimeUnit.MINUTES.toNanos(1));
assertThat(source.getTimeout(null)).isEqualTo(MINUTE_IN_NANOS);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,18 @@ void after() {
}

@Test
public void clientGetSetname() {
public void clientGetNameReturnsNullWhenNotSet() {
assertThat(sentinel.clientGetname()).isNull();
}

@Test
public void clientSetNameWithNonEmptyStringSetsNameAndReturnsOk() {
assertThat(sentinel.clientSetname("test")).isEqualTo("OK");
assertThat(sentinel.clientGetname()).isEqualTo("test");
}

@Test
public void clientSetNameWithEmptyStringClearsNameAndReturnsOk() {
assertThat(sentinel.clientSetname("")).isEqualTo("OK");
assertThat(sentinel.clientGetname()).isNull();
}
Expand Down