diff options
Diffstat (limited to 'container-core/src/test/java/com/yahoo/container/di/componentgraph')
5 files changed, 110 insertions, 113 deletions
diff --git a/container-core/src/test/java/com/yahoo/container/di/componentgraph/core/ComponentGraphTest.java b/container-core/src/test/java/com/yahoo/container/di/componentgraph/core/ComponentGraphTest.java index 5abb96527bd..c21c1b35782 100644 --- a/container-core/src/test/java/com/yahoo/container/di/componentgraph/core/ComponentGraphTest.java +++ b/container-core/src/test/java/com/yahoo/container/di/componentgraph/core/ComponentGraphTest.java @@ -18,7 +18,7 @@ import com.yahoo.config.test.Test2Config; import com.yahoo.config.test.TestConfig; import com.yahoo.container.di.componentgraph.Provider; import com.yahoo.vespa.config.ConfigKey; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.lang.annotation.Annotation; import java.util.Collections; @@ -30,13 +30,7 @@ import java.util.concurrent.Executors; import java.util.function.Supplier; import static com.yahoo.container.di.componentgraph.core.ComponentGraph.isBindingAnnotation; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; /** * @author gjoranv @@ -65,7 +59,7 @@ public class ComponentGraphTest { } @Test - public void component_taking_config_can_be_instantiated() { + void component_taking_config_can_be_instantiated() { ComponentGraph componentGraph = new ComponentGraph(); String configId = "raw:stringVal \"test-value\""; Node componentNode = mockComponentNode(ComponentTakingConfig.class, configId); @@ -80,7 +74,7 @@ public class ComponentGraphTest { } @Test - public void all_created_components_are_returned_in_reverse_topological_order() { + void all_created_components_are_returned_in_reverse_topological_order() { for (int i = 0; i < 10; i++) { Node innerComponent = mockComponentNode(SimpleComponent.class); Node middleComponent = mockComponentNode(ComponentTakingComponent.class); @@ -97,12 +91,12 @@ public class ComponentGraphTest { outerComponent.constructInstance(); assertEquals(List.of(outerComponent.constructedInstance().get(), middleComponent.constructedInstance().get(), innerComponent.constructedInstance().get()), - componentGraph.allConstructedComponentsAndProviders()); + componentGraph.allConstructedComponentsAndProviders()); } } @Test - public void component_can_be_explicitly_injected_into_another_component() { + void component_can_be_explicitly_injected_into_another_component() { Node injectedComponent = mockComponentNode(SimpleComponent.class); Node targetComponent = mockComponentNode(ComponentTakingComponent.class); targetComponent.inject(injectedComponent); @@ -121,7 +115,7 @@ public class ComponentGraphTest { } @Test - public void explicitly_injected_components_may_be_unused() { + void explicitly_injected_components_may_be_unused() { Node notUsingInjected = mockComponentNode(SimpleComponent.class); Node injectedComponent = mockComponentNode(SimpleComponent2.class); notUsingInjected.inject(injectedComponent); @@ -136,7 +130,7 @@ public class ComponentGraphTest { } @Test - public void interface_implementation_can_be_injected() { + void interface_implementation_can_be_injected() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(ComponentImpl.class)); componentGraph.add(mockComponentNode(ComponentTakingInterface.class)); @@ -147,7 +141,7 @@ public class ComponentGraphTest { } @Test - public void private_class_with_public_ctor_can_be_instantiated() { + void private_class_with_public_ctor_can_be_instantiated() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(PrivateClassComponent.class)); componentGraph.complete(); @@ -157,7 +151,7 @@ public class ComponentGraphTest { } @Test - public void all_components_of_a_type_can_be_injected() { + void all_components_of_a_type_can_be_injected() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(SimpleComponent.class)); componentGraph.add(mockComponentNode(SimpleComponent.class)); @@ -170,7 +164,7 @@ public class ComponentGraphTest { } @Test - public void empty_component_registry_can_be_injected() { + void empty_component_registry_can_be_injected() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(ComponentTakingAllSimpleComponents.class)); componentGraph.complete(); @@ -180,7 +174,7 @@ public class ComponentGraphTest { } @Test - public void component_registry_with_wildcard_upper_bound_can_be_injected() { + void component_registry_with_wildcard_upper_bound_can_be_injected() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(SimpleComponent.class)); componentGraph.add(mockComponentNode(SimpleDerivedComponent.class)); @@ -192,22 +186,24 @@ public class ComponentGraphTest { assertEquals(2, instance.simpleComponents.allComponents().size()); } - @Test(expected = RuntimeException.class) - public void require_exception_when_injecting_registry_with_unknown_type_variable() { - @SuppressWarnings("rawtypes") - Class<ComponentTakingAllComponentsWithTypeVariable> clazz = ComponentTakingAllComponentsWithTypeVariable.class; + @Test + void require_exception_when_injecting_registry_with_unknown_type_variable() { + assertThrows(RuntimeException.class, () -> { + @SuppressWarnings("rawtypes") + Class<ComponentTakingAllComponentsWithTypeVariable> clazz = ComponentTakingAllComponentsWithTypeVariable.class; - ComponentGraph componentGraph = new ComponentGraph(); - componentGraph.add(mockComponentNode(SimpleComponent.class)); - componentGraph.add(mockComponentNode(SimpleDerivedComponent.class)); - componentGraph.add(mockComponentNode(clazz)); - componentGraph.complete(); + ComponentGraph componentGraph = new ComponentGraph(); + componentGraph.add(mockComponentNode(SimpleComponent.class)); + componentGraph.add(mockComponentNode(SimpleDerivedComponent.class)); + componentGraph.add(mockComponentNode(clazz)); + componentGraph.complete(); - componentGraph.getInstance(clazz); + componentGraph.getInstance(clazz); + }); } @Test - public void components_are_shared() { + void components_are_shared() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(SimpleComponent.class)); componentGraph.complete(); @@ -218,7 +214,7 @@ public class ComponentGraphTest { } @Test - public void singleton_components_can_be_injected() { + void singleton_components_can_be_injected() { ComponentGraph componentGraph = new ComponentGraph(); String configId = "raw:stringVal \"test-value\""; @@ -233,17 +229,19 @@ public class ComponentGraphTest { assertEquals("test-value", injected.config.stringVal()); } - @Test(expected = RuntimeException.class) - public void require_error_when_multiple_components_match_a_singleton_dependency() { - ComponentGraph componentGraph = new ComponentGraph(); - componentGraph.add(mockComponentNode(SimpleDerivedComponent.class)); - componentGraph.add(mockComponentNode(SimpleComponent.class)); - componentGraph.add(mockComponentNode(ComponentTakingComponent.class)); - componentGraph.complete(); + @Test + void require_error_when_multiple_components_match_a_singleton_dependency() { + assertThrows(RuntimeException.class, () -> { + ComponentGraph componentGraph = new ComponentGraph(); + componentGraph.add(mockComponentNode(SimpleDerivedComponent.class)); + componentGraph.add(mockComponentNode(SimpleComponent.class)); + componentGraph.add(mockComponentNode(ComponentTakingComponent.class)); + componentGraph.complete(); + }); } @Test - public void named_component_can_be_injected() { + void named_component_can_be_injected() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(SimpleComponent.class)); componentGraph.add(mockComponentNode(SimpleComponent.class, Names.named("named-test"))); @@ -252,7 +250,7 @@ public class ComponentGraphTest { } @Test - public void config_keys_can_be_retrieved() { + void config_keys_can_be_retrieved() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(ComponentTakingConfig.class, "raw:stringVal \"component1\"")); componentGraph.add(mockComponentNode(ComponentTakingConfig.class, "raw:stringVal \"component2\"")); @@ -269,7 +267,7 @@ public class ComponentGraphTest { } @Test - public void providers_can_be_instantiated() { + void providers_can_be_instantiated() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(ExecutorProvider.class)); componentGraph.complete(); @@ -278,7 +276,7 @@ public class ComponentGraphTest { } @Test - public void providers_can_be_inherited() { + void providers_can_be_inherited() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(DerivedExecutorProvider.class)); componentGraph.complete(); @@ -287,7 +285,7 @@ public class ComponentGraphTest { } @Test - public void providers_can_deliver_a_new_instance_for_each_component() { + void providers_can_deliver_a_new_instance_for_each_component() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(NewIntProvider.class)); componentGraph.complete(); @@ -299,7 +297,7 @@ public class ComponentGraphTest { } @Test - public void providers_can_be_injected_explicitly() { + void providers_can_be_injected_explicitly() { ComponentGraph componentGraph = new ComponentGraph(); Node componentTakingExecutor = mockComponentNode(ComponentTakingExecutor.class); @@ -316,7 +314,7 @@ public class ComponentGraphTest { } @Test - public void global_providers_can_be_injected() { + void global_providers_can_be_injected() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(ComponentTakingExecutor.class)); @@ -327,18 +325,20 @@ public class ComponentGraphTest { assertNotNull(componentGraph.getInstance(ComponentTakingExecutor.class)); } - @Test(expected = RuntimeException.class) - public void throw_if_multiple_global_providers_exist() { - ComponentGraph componentGraph = new ComponentGraph(); + @Test + void throw_if_multiple_global_providers_exist() { + assertThrows(RuntimeException.class, () -> { + ComponentGraph componentGraph = new ComponentGraph(); - componentGraph.add(mockComponentNode(ExecutorProvider.class)); - componentGraph.add(mockComponentNode(ExecutorProvider.class)); - componentGraph.add(mockComponentNode(ComponentTakingExecutor.class)); - componentGraph.complete(); + componentGraph.add(mockComponentNode(ExecutorProvider.class)); + componentGraph.add(mockComponentNode(ExecutorProvider.class)); + componentGraph.add(mockComponentNode(ComponentTakingExecutor.class)); + componentGraph.complete(); + }); } @Test - public void provider_is_not_used_when_component_of_provided_class_exists() { + void provider_is_not_used_when_component_of_provided_class_exists() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(SimpleComponent.class)); @@ -352,13 +352,13 @@ public class ComponentGraphTest { //TODO: move @Test - public void check_if_annotation_is_a_binding_annotation() { + void check_if_annotation_is_a_binding_annotation() { assertTrue(isBindingAnnotation(Names.named("name"))); assertFalse(isBindingAnnotation(Named.class.getAnnotations()[0])); } @Test - public void cycles_gives_exception() { + void cycles_gives_exception() { ComponentGraph componentGraph = new ComponentGraph(); Node node1 = mockComponentNode(ComponentCausingCycle.class); @@ -379,18 +379,20 @@ public class ComponentGraphTest { } } - @Test(expected = IllegalArgumentException.class) - public void abstract_classes_are_rejected() { - new ComponentNode(ComponentId.fromString("Test"), "", AbstractClass.class); + @Test + void abstract_classes_are_rejected() { + assertThrows(IllegalArgumentException.class, () -> { + new ComponentNode(ComponentId.fromString("Test"), "", AbstractClass.class); + }); } @Test - public void inject_constructor_is_preferred() { + void inject_constructor_is_preferred() { assertThatComponentCanBeCreated(ComponentWithInjectConstructor.class); } @Test - public void constructor_with_most_parameters_is_preferred() { + void constructor_with_most_parameters_is_preferred() { assertThatComponentCanBeCreated(ComponentWithMultipleConstructors.class); } @@ -407,7 +409,7 @@ public class ComponentGraphTest { } @Test - public void require_fallback_to_child_injector() { + void require_fallback_to_child_injector() { ComponentGraph componentGraph = new ComponentGraph(); componentGraph.add(mockComponentNode(ComponentTakingExecutor.class)); @@ -417,7 +419,7 @@ public class ComponentGraphTest { } @Test - public void child_injector_can_inject_multiple_instances_for_same_key() { + void child_injector_can_inject_multiple_instances_for_same_key() { Pair<Integer, Pair<Executor, Executor>> graph = buildGraphWithChildInjector(Executors::newSingleThreadExecutor); int graphSize = graph.getFirst(); Executor executorA = graph.getSecond().getFirst(); @@ -428,7 +430,7 @@ public class ComponentGraphTest { } @Test - public void components_injected_via_child_injector_can_be_shared() { + void components_injected_via_child_injector_can_be_shared() { Executor commonExecutor = Executors.newSingleThreadExecutor(); Pair<Integer, Pair<Executor, Executor>> graph = buildGraphWithChildInjector(() -> commonExecutor); int graphSize = graph.getFirst(); @@ -462,7 +464,7 @@ public class ComponentGraphTest { } @Test - public void providers_can_be_reused() { + void providers_can_be_reused() { ComponentGraph oldGraph = createReusingGraph(); Executor executor = oldGraph.getInstance(Executor.class); @@ -483,7 +485,7 @@ public class ComponentGraphTest { } @Test - public void component_id_can_be_injected() { + void component_id_can_be_injected() { String componentId = "myId:1.2@namespace"; ComponentGraph componentGraph = new ComponentGraph(); diff --git a/container-core/src/test/java/com/yahoo/container/di/componentgraph/core/FallbackToGuiceInjectorTest.java b/container-core/src/test/java/com/yahoo/container/di/componentgraph/core/FallbackToGuiceInjectorTest.java index 1e3d67ed463..878c245a708 100644 --- a/container-core/src/test/java/com/yahoo/container/di/componentgraph/core/FallbackToGuiceInjectorTest.java +++ b/container-core/src/test/java/com/yahoo/container/di/componentgraph/core/FallbackToGuiceInjectorTest.java @@ -11,18 +11,15 @@ import com.yahoo.component.AbstractComponent; import com.yahoo.component.ComponentId; import com.yahoo.config.ConfigInstance; import com.yahoo.vespa.config.ConfigKey; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.HashMap; import java.util.Map; import java.util.concurrent.Executor; import java.util.concurrent.Executors; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; /** * @author Tony Vaagenes @@ -36,7 +33,7 @@ public class FallbackToGuiceInjectorTest { private final Map<ConfigKey<? extends ConfigInstance>, ConfigInstance> configs = new HashMap<>(); - @Before + @BeforeEach public void createGraph() { injector = Guice.createInjector(); componentGraph = new ComponentGraph(0); @@ -70,7 +67,7 @@ public class FallbackToGuiceInjectorTest { } @Test - public void guice_injector_is_used_when_no_global_component_exists() { + void guice_injector_is_used_when_no_global_component_exists() { setInjector( Guice.createInjector(new AbstractModule() { @Override @@ -89,7 +86,7 @@ public class FallbackToGuiceInjectorTest { } @Test - public void guice_injector_creates_a_new_instance_with_default_ctor_when_no_explicit_binding_exists() { + void guice_injector_creates_a_new_instance_with_default_ctor_when_no_explicit_binding_exists() { setInjector(emptyGuiceInjector()); register(ComponentTakingDefaultString.class); complete(); @@ -99,7 +96,7 @@ public class FallbackToGuiceInjectorTest { } @Test - public void guice_injector_fails_when_no_explicit_binding_exists_and_class_has_no_default_ctor() { + void guice_injector_fails_when_no_explicit_binding_exists_and_class_has_no_default_ctor() { setInjector(emptyGuiceInjector()); register(ComponentThatCannotBeConstructed.class); try { diff --git a/container-core/src/test/java/com/yahoo/container/di/componentgraph/core/ReuseComponentsTest.java b/container-core/src/test/java/com/yahoo/container/di/componentgraph/core/ReuseComponentsTest.java index 2215fcdf4dd..edd06e37e64 100644 --- a/container-core/src/test/java/com/yahoo/container/di/componentgraph/core/ReuseComponentsTest.java +++ b/container-core/src/test/java/com/yahoo/container/di/componentgraph/core/ReuseComponentsTest.java @@ -14,16 +14,14 @@ import com.yahoo.container.di.componentgraph.core.ComponentGraphTest.ExecutorPro import com.yahoo.container.di.componentgraph.core.ComponentGraphTest.SimpleComponent; import com.yahoo.container.di.componentgraph.core.ComponentGraphTest.SimpleComponent2; import com.yahoo.vespa.config.ConfigKey; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.concurrent.Executor; import java.util.function.Function; import java.util.function.Supplier; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.*; /** * @author gjoranv @@ -32,7 +30,7 @@ import static org.junit.Assert.assertSame; */ public class ReuseComponentsTest { @Test - public void require_that_component_is_reused_when_componentNode_is_unmodified() { + void require_that_component_is_reused_when_componentNode_is_unmodified() { reuseAndTest(SimpleComponent.class, SimpleComponent.class); reuseAndTest(ExecutorProvider.class, Executor.class); } @@ -48,23 +46,25 @@ public class ReuseComponentsTest { assertSame(instance2, instance); } - @Test(expected = IllegalStateException.class) - public void require_that_component_is_not_reused_when_class_is_changed() { - ComponentGraph graph = buildGraphAndSetNoConfigs(SimpleComponent.class); - SimpleComponent instance = getComponent(graph, SimpleComponent.class); - - ComponentGraph newGraph = buildGraphAndSetNoConfigs(SimpleComponent2.class); - newGraph.reuseNodes(graph); - SimpleComponent2 instance2 = getComponent(newGraph, SimpleComponent2.class); - - assertEquals(instance2.getId(),instance.getId()); - @SuppressWarnings("unused") - SimpleComponent throwsException = getComponent(newGraph, SimpleComponent.class); + @Test + void require_that_component_is_not_reused_when_class_is_changed() { + assertThrows(IllegalStateException.class, () -> { + ComponentGraph graph = buildGraphAndSetNoConfigs(SimpleComponent.class); + SimpleComponent instance = getComponent(graph, SimpleComponent.class); + + ComponentGraph newGraph = buildGraphAndSetNoConfigs(SimpleComponent2.class); + newGraph.reuseNodes(graph); + SimpleComponent2 instance2 = getComponent(newGraph, SimpleComponent2.class); + + assertEquals(instance2.getId(), instance.getId()); + @SuppressWarnings("unused") + SimpleComponent throwsException = getComponent(newGraph, SimpleComponent.class); + }); } @SuppressWarnings("deprecation") @Test - public void require_that_component_is_not_reused_when_config_is_changed() { + void require_that_component_is_not_reused_when_config_is_changed() { Class<ComponentTakingConfig> componentClass = ComponentTakingConfig.class; ComponentGraph graph = buildGraph(componentClass); @@ -83,7 +83,7 @@ public class ReuseComponentsTest { @SuppressWarnings("deprecation") @Test - public void require_that_component_is_not_reused_when_injected_component_is_changed() { + void require_that_component_is_not_reused_when_injected_component_is_changed() { Function<String, ComponentGraph> buildGraph = config -> { ComponentGraph graph = new ComponentGraph(); @@ -115,7 +115,7 @@ public class ReuseComponentsTest { } @Test - public void require_that_component_is_not_reused_when_injected_component_registry_has_one_component_removed() { + void require_that_component_is_not_reused_when_injected_component_registry_has_one_component_removed() { Function<Boolean, ComponentGraph> buildGraph = useBothInjectedComponents -> { ComponentGraph graph = new ComponentGraph(); graph.add(mockComponentNode(ComponentTakingAllSimpleComponents.class, "root_component")); @@ -148,7 +148,7 @@ public class ReuseComponentsTest { @SuppressWarnings("deprecation") @Test - public void require_that_injected_component_is_reused_even_when_dependent_component_is_changed() { + void require_that_injected_component_is_reused_even_when_dependent_component_is_changed() { Function<String, ComponentGraph> buildGraph = config -> { ComponentGraph graph = new ComponentGraph(); @@ -183,7 +183,7 @@ public class ReuseComponentsTest { } @Test - public void require_that_node_depending_on_guice_node_is_reused() { + void require_that_node_depending_on_guice_node_is_reused() { Supplier<ComponentGraph> makeGraph = () -> { ComponentGraph graph = new ComponentGraph(); graph.add(mockComponentNode(ComponentTakingExecutor.class, "dummyId")); @@ -202,7 +202,7 @@ public class ReuseComponentsTest { } @Test - public void require_that_node_equals_only_checks_first_level_components_to_inject() { + void require_that_node_equals_only_checks_first_level_components_to_inject() { Function<String, Node> createNodeWithInjectedNodeWithInjectedNode = indirectlyInjectedComponentId -> { ComponentNode targetComponent = mockComponentNode(SimpleComponent.class, "target"); ComponentNode directlyInjectedComponent = mockComponentNode(SimpleComponent.class, "directlyInjected"); diff --git a/container-core/src/test/java/com/yahoo/container/di/componentgraph/cycle/CycleFinderTest.java b/container-core/src/test/java/com/yahoo/container/di/componentgraph/cycle/CycleFinderTest.java index 65fbdc578aa..b7ce61c2f1a 100644 --- a/container-core/src/test/java/com/yahoo/container/di/componentgraph/cycle/CycleFinderTest.java +++ b/container-core/src/test/java/com/yahoo/container/di/componentgraph/cycle/CycleFinderTest.java @@ -2,7 +2,7 @@ package com.yahoo.container.di.componentgraph.cycle; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; @@ -10,7 +10,7 @@ import static com.yahoo.container.di.componentgraph.cycle.CycleFinderTest.Vertic import static com.yahoo.container.di.componentgraph.cycle.CycleFinderTest.Vertices.B; import static com.yahoo.container.di.componentgraph.cycle.CycleFinderTest.Vertices.C; import static com.yahoo.container.di.componentgraph.cycle.CycleFinderTest.Vertices.D; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author gjoranv @@ -20,7 +20,7 @@ public class CycleFinderTest { enum Vertices {A, B, C, D} @Test - public void graph_without_cycles_returns_no_cycle() { + void graph_without_cycles_returns_no_cycle() { var graph = new Graph<Vertices>(); graph.edge(A, B); graph.edge(B, C); @@ -32,7 +32,7 @@ public class CycleFinderTest { } @Test - public void graph_with_cycle_returns_cycle() { + void graph_with_cycle_returns_cycle() { var graph = new Graph<Vertices>(); graph.edge(A, B); graph.edge(B, C); @@ -43,7 +43,7 @@ public class CycleFinderTest { } @Test - public void graph_with_self_referencing_vertex_returns_cycle() { + void graph_with_self_referencing_vertex_returns_cycle() { var graph = new Graph<Vertices>(); graph.edge(A, A); @@ -52,7 +52,7 @@ public class CycleFinderTest { } @Test - public void leading_nodes_are_stripped_from_cycle() { + void leading_nodes_are_stripped_from_cycle() { var graph = new Graph<Vertices>(); graph.edge(A, B); graph.edge(B, C); @@ -63,7 +63,7 @@ public class CycleFinderTest { } @Test - public void findCycle_is_idempotent_with_cycle() { + void findCycle_is_idempotent_with_cycle() { var graph = new Graph<Vertices>(); graph.edge(A, A); @@ -73,7 +73,7 @@ public class CycleFinderTest { } @Test - public void findCycle_is_idempotent_without_cycle() { + void findCycle_is_idempotent_without_cycle() { var graph = new Graph<Vertices>(); graph.edge(A, B); diff --git a/container-core/src/test/java/com/yahoo/container/di/componentgraph/cycle/GraphTest.java b/container-core/src/test/java/com/yahoo/container/di/componentgraph/cycle/GraphTest.java index 526e683ad46..d945b4f0544 100644 --- a/container-core/src/test/java/com/yahoo/container/di/componentgraph/cycle/GraphTest.java +++ b/container-core/src/test/java/com/yahoo/container/di/componentgraph/cycle/GraphTest.java @@ -2,16 +2,14 @@ package com.yahoo.container.di.componentgraph.cycle; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; import static com.yahoo.container.di.componentgraph.cycle.GraphTest.Vertices.A; import static com.yahoo.container.di.componentgraph.cycle.GraphTest.Vertices.B; import static com.yahoo.container.di.componentgraph.cycle.GraphTest.Vertices.C; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; /** * @author gjoranv @@ -21,7 +19,7 @@ public class GraphTest { enum Vertices {A, B, C} @Test - public void vertices_and_edges_are_added_and_can_be_retrieved() { + void vertices_and_edges_are_added_and_can_be_retrieved() { var graph = new Graph<Vertices>(); graph.edge(A, B); graph.edge(B, C); @@ -34,7 +32,7 @@ public class GraphTest { } @Test - public void null_vertices_are_not_allowed() { + void null_vertices_are_not_allowed() { var graph = new Graph<Vertices>(); try { @@ -46,7 +44,7 @@ public class GraphTest { } @Test - public void duplicate_edges_are_ignored() { + void duplicate_edges_are_ignored() { var graph = new Graph<Vertices>(); graph.edge(A, B); graph.edge(A, B); @@ -55,7 +53,7 @@ public class GraphTest { } @Test - public void self_edges_are_allowed() { + void self_edges_are_allowed() { var graph = new Graph<Vertices>(); graph.edge(A, A); |