Skip to content

Commit

Permalink
grpc-api: Whitespace formatting for unrelated code and Reverted stati…
Browse files Browse the repository at this point in the history
…c import for InternalTimeUtils.convert method
  • Loading branch information
SreeramdasLavanya committed Oct 16, 2024
1 parent e76d673 commit f01209b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions api/src/test/java/io/grpc/InternalTimeUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,45 @@

package io.grpc;

import static io.grpc.InternalTimeUtils.convert;
import static org.junit.Assert.assertEquals;

import java.time.Duration;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** Unit tests for {@link InternalTimeUtils}. */
@RunWith(JUnit4.class)
public class InternalTimeUtilsTest {

private InternalTimeUtils internalTimeUtils = new InternalTimeUtils();
@Test
public void testConvertNormalDuration() {
Duration duration = Duration.ofSeconds(10);
long expected = 10 * 1_000_000_000L;

assertEquals(expected, convert(duration));
assertEquals(expected, internalTimeUtils.convert(duration));
}

@Test
public void testConvertNegativeDuration() {
Duration duration = Duration.ofSeconds(-3);
long expected = -3 * 1_000_000_000L;

assertEquals(expected, convert(duration));
assertEquals(expected, internalTimeUtils.convert(duration));
}

@Test
public void testConvertTooLargeDuration() {
Duration duration = Duration.ofSeconds(Long.MAX_VALUE / 1_000_000_000L + 1);

assertEquals(Long.MAX_VALUE, convert(duration));
assertEquals(Long.MAX_VALUE, internalTimeUtils.convert(duration));
}

@Test
public void testConvertTooLargeNegativeDuration() {
Duration duration = Duration.ofSeconds(Long.MIN_VALUE / 1_000_000_000L - 1);

assertEquals(Long.MIN_VALUE, convert(duration));
assertEquals(Long.MIN_VALUE, internalTimeUtils.convert(duration));
}
}
2 changes: 1 addition & 1 deletion api/src/test/java/io/grpc/SynchronizationContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void uncaughtException(Thread t, Throwable e) {

@Mock
private Runnable task3;

@After public void tearDown() {
assertThat(uncaughtErrors).isEmpty();
}
Expand Down

0 comments on commit f01209b

Please sign in to comment.