Skip to content

Commit

Permalink
Fix style; add simple feature impl selection test
Browse files Browse the repository at this point in the history
  • Loading branch information
tjquinno committed Aug 18, 2023
1 parent 67336ce commit f570cc0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static MeterRegistry globalRegistry() {

/**
* Creates a meter registry, not added to the global registry, based on
* the provide metrics config.
* the provided metrics config.
*
* @param metricsConfig metrics config
* @return new meter registry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import io.helidon.webserver.http.HttpService;
import io.helidon.webserver.http.ServerRequest;
import io.helidon.webserver.http.ServerResponse;
import io.helidon.webserver.servicecommon.HelidonFeatureSupport;

import static io.helidon.http.Http.HeaderNames.ALLOW;
import static io.helidon.http.Http.Status.METHOD_NOT_ALLOWED_405;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.helidon.webserver.observe.metrics;

import org.junit.jupiter.api.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.not;

class SimpleFeatureTest {

// TODO remove once we do not have selective building based on the system property
@Test
void testSelection() {
MetricsFeature metricsFeature = MetricsFeature.builder().build();
assertThat("Feature selection", metricsFeature, not(instanceOf(MetricsFeature4.class)));

try {
System.setProperty("newMetricsAPI", "true");

metricsFeature = MetricsFeature.builder().build();
assertThat("Feature selection", metricsFeature, instanceOf(MetricsFeature4.class));
} finally {
System.clearProperty("newMetricsAPI");
}
}
}

0 comments on commit f570cc0

Please sign in to comment.