Skip to content
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.

Commit

Permalink
PR#4: Test coverage for public constructors.
Browse files Browse the repository at this point in the history
  • Loading branch information
rajuGT committed Aug 13, 2017
1 parent a2a7593 commit 83ae0b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/main/java/org/zapodot/hystrix/bundle/HystrixBundle.java
Expand Up @@ -31,9 +31,7 @@ public class HystrixBundle<T extends Configuration> implements ConfiguredBundle<
private final boolean publishHystrixMetrics;

public HystrixBundle() {
this.adminStreamPath = DEFAULT_STREAM_PATH;
this.applicationStreamUri = null;
this.publishHystrixMetrics = DEFAULT_PUBLISH_HYSTRIX_METRICS;
this(DEFAULT_STREAM_PATH, null, DEFAULT_PUBLISH_HYSTRIX_METRICS);
}

/**
Expand Down
19 changes: 17 additions & 2 deletions src/test/java/org/zapodot/hystrix/bundle/HystrixBundleTest.java
Expand Up @@ -43,8 +43,8 @@ public void setUp() throws Exception {
}

@Test
public void testWithDefaults() throws Exception {
final HystrixBundle hystrixBundle = HystrixBundle.withDefaultSettings();
public void testWithDefaultsUsingConstructor() throws Exception {
final HystrixBundle hystrixBundle = new HystrixBundle();
hystrixBundle.initialize(bootstrap);
hystrixBundle.run(configuration, environment);
assertNotNull(environment.getAdminContext()
Expand All @@ -57,6 +57,21 @@ public void testWithDefaults() throws Exception {
verifyZeroInteractions(bootstrap);
}

@Test
public void testWithDefaultsUsingBuilder() throws Exception {
final HystrixBundle hystrixBundle = HystrixBundle.withDefaultSettings();
hystrixBundle.initialize(bootstrap);
hystrixBundle.run(configuration, environment);
assertNotNull(environment.getAdminContext()
.getServletContext()
.getServletRegistration(HystrixBundle.SERVLET_NAME));
assertNull(environment.getApplicationContext()
.getServletContext()
.getServletRegistration(HystrixBundle.SERVLET_NAME));
assertTrue(HystrixPlugins.getInstance().getMetricsPublisher() instanceof HystrixCodaHaleMetricsPublisher);
verifyZeroInteractions(bootstrap);
}

@Test
public void testAddToApplicationContext() throws Exception {
final HystrixBundle hystrixBundle = HystrixBundle.builder().withApplicationStreamPath(HystrixBundle.DEFAULT_STREAM_PATH).disableStreamServletInAdminContext().build();
Expand Down

0 comments on commit 83ae0b2

Please sign in to comment.