Skip to content

Commit

Permalink
Try to figure out travis error
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed May 15, 2016
1 parent 96cb886 commit 1a35b69
Showing 1 changed file with 38 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@
@RunWith(JUnit4.class)
public class GrpcServiceOptionsTest {

private static final TestGrpcServiceOptions OPTIONS = TestGrpcServiceOptions.builder()
.initialTimeout(1234)
.timeoutMultiplier(1.6)
.maxTimeout(5678)
.build();
private static final TestGrpcServiceOptions DEFAULT_OPTIONS =
TestGrpcServiceOptions.builder().build();
private static final TestGrpcServiceOptions OPTIONS_COPY = OPTIONS.toBuilder().build();

private interface TestService extends Service<TestGrpcServiceOptions> {}

private static class TestServiceImpl
Expand Down Expand Up @@ -137,12 +128,20 @@ public int hashCode() {

@Test
public void testBuilder() {
assertEquals(1234, OPTIONS.initialTimeout());
assertEquals(1.6, OPTIONS.timeoutMultiplier(), 0.0);
assertEquals(5678, OPTIONS.maxTimeout());
assertEquals(20000, DEFAULT_OPTIONS.initialTimeout());
assertEquals(1.5, DEFAULT_OPTIONS.timeoutMultiplier(), 0.0);
assertEquals(100000, DEFAULT_OPTIONS.maxTimeout());
TestGrpcServiceOptions options = TestGrpcServiceOptions.builder()
.initialTimeout(1234)
.timeoutMultiplier(1.6)
.maxTimeout(5678)
.build();
TestGrpcServiceOptions defaultOptions =
TestGrpcServiceOptions.builder().build();
TestGrpcServiceOptions optionsCopy = options.toBuilder().build();
assertEquals(1234, options.initialTimeout());
assertEquals(1.6, options.timeoutMultiplier(), 0.0);
assertEquals(5678, options.maxTimeout());
assertEquals(20000, defaultOptions.initialTimeout());
assertEquals(1.5, defaultOptions.timeoutMultiplier(), 0.0);
assertEquals(100000, defaultOptions.maxTimeout());
}

@Test
Expand Down Expand Up @@ -181,13 +180,33 @@ public void testBuilderInvalidMaxTimeout() {

@Test
public void testBaseEquals() {
assertEquals(OPTIONS, OPTIONS_COPY);
assertNotEquals(DEFAULT_OPTIONS, OPTIONS);
try {
TestGrpcServiceOptions options = TestGrpcServiceOptions.builder()
.initialTimeout(1234)
.timeoutMultiplier(1.6)
.maxTimeout(5678)
.build();
TestGrpcServiceOptions defaultOptions =
TestGrpcServiceOptions.builder().build();
TestGrpcServiceOptions optionsCopy = options.toBuilder().build();
assertEquals(options, optionsCopy);
assertNotEquals(defaultOptions, options);
} catch (Exception ex) {
ex.printStackTrace();
}
}

@Test
public void testBaseHashCode() {
assertEquals(OPTIONS.hashCode(), OPTIONS_COPY.hashCode());
assertNotEquals(DEFAULT_OPTIONS.hashCode(), OPTIONS.hashCode());
TestGrpcServiceOptions options = TestGrpcServiceOptions.builder()
.initialTimeout(1234)
.timeoutMultiplier(1.6)
.maxTimeout(5678)
.build();
TestGrpcServiceOptions defaultOptions =
TestGrpcServiceOptions.builder().build();
TestGrpcServiceOptions optionsCopy = options.toBuilder().build();
assertEquals(options.hashCode(), optionsCopy.hashCode());
assertNotEquals(defaultOptions.hashCode(), options.hashCode());
}
}

0 comments on commit 1a35b69

Please sign in to comment.