diff options
Diffstat (limited to 'policy-utils/src/test/java/org')
10 files changed, 117 insertions, 97 deletions
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/metrics/MetricTest.java b/policy-utils/src/test/java/org/onap/policy/drools/metrics/MetricTest.java index 5a5965c4..924d1c95 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/metrics/MetricTest.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/metrics/MetricTest.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +23,10 @@ package org.onap.policy.drools.metrics; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import com.openpojo.reflection.PojoClass; import com.openpojo.reflection.impl.PojoClassFactory; @@ -39,12 +40,12 @@ import java.text.SimpleDateFormat; import java.time.Duration; import java.time.Instant; import java.util.Date; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class MetricTest { +class MetricTest { @Test - public void testPojo() { + void testPojo() { PojoClass metric = PojoClassFactory.getPojoClass(Metric.class); Validator val = ValidatorBuilder .create() @@ -57,7 +58,7 @@ public class MetricTest { } @Test - public void testEndTimeSetter() { + void testEndTimeSetter() { Metric metric = new Metric(); assertNull(metric.getEndTime()); @@ -66,7 +67,7 @@ public class MetricTest { } @Test - public void testStartTimeSetter() { + void testStartTimeSetter() { Metric metric = new Metric(); assertNull(metric.getStartTime()); @@ -75,7 +76,7 @@ public class MetricTest { } @Test - public void testElapsedTimeSetter() { + void testElapsedTimeSetter() { Metric metric = new Metric(); assertNull(metric.getElapsedTime()); @@ -96,7 +97,7 @@ public class MetricTest { } @Test - public void testInvocationIdSetter() { + void testInvocationIdSetter() { Metric metric = new Metric(); assertNull(metric.getInvocationId()); @@ -105,7 +106,7 @@ public class MetricTest { } @Test - public void testServiceNameSetter() { + void testServiceNameSetter() { Metric metric = new Metric(); assertNull(metric.getServiceName()); @@ -114,7 +115,7 @@ public class MetricTest { } @Test - public void testInstanceUuidSetter() { + void testInstanceUuidSetter() { Metric metric = new Metric(); assertNull(metric.getInstanceUuid()); @@ -123,7 +124,7 @@ public class MetricTest { } @Test - public void testRequestIdSetter() { + void testRequestIdSetter() { Metric metric = new Metric(); assertNull(metric.getRequestId()); @@ -132,7 +133,7 @@ public class MetricTest { } @Test - public void testPartnerSetter() { + void testPartnerSetter() { Metric metric = new Metric(); assertNull(metric.getPartner()); @@ -141,7 +142,7 @@ public class MetricTest { } @Test - public void testServerNameSetter() { + void testServerNameSetter() { Metric metric = new Metric(); assertNull(metric.getServerName()); @@ -150,7 +151,7 @@ public class MetricTest { } @Test - public void testServerFqdnSetter() { + void testServerFqdnSetter() { Metric metric = new Metric(); assertNull(metric.getServerFqdn()); @@ -159,7 +160,7 @@ public class MetricTest { } @Test - public void testVirtualServerNameSetter() { + void testVirtualServerNameSetter() { Metric metric = new Metric(); assertNull(metric.getVirtualServerName()); @@ -168,7 +169,7 @@ public class MetricTest { } @Test - public void testEqualsToString() { + void testEqualsToString() { Metric metric1 = new Metric(); Metric metric2 = new Metric(); @@ -185,7 +186,7 @@ public class MetricTest { } @Test - public void testToTimestamp() { + void testToTimestamp() { Instant now = Instant.now(); assertEquals(new SimpleDateFormat(Metric.DATE_FORMAT).format(Date.from(now)), Metric.toTimestamp(now)); } diff --git a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Metadata.java b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Metadata.java index 0cad4ff0..e81bdd05 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Metadata.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Metadata.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +22,7 @@ package org.onap.policy.drools.models.domains.a; import com.google.gson.annotations.SerializedName; +import java.io.Serial; import java.io.Serializable; import lombok.Builder; import lombok.Data; @@ -28,6 +30,7 @@ import lombok.Data; @Data @Builder public class Metadata implements Serializable { + @Serial private static final long serialVersionUID = 476541531265304644L; @SerializedName("policy-id") diff --git a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Nested.java b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Nested.java index eedadeff..1d46d59d 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Nested.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Nested.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +22,7 @@ package org.onap.policy.drools.models.domains.a; import com.google.gson.annotations.SerializedName; +import java.io.Serial; import java.io.Serializable; import lombok.Builder; import lombok.Data; @@ -28,6 +30,7 @@ import lombok.Data; @Data @Builder public class Nested implements Serializable { + @Serial private static final long serialVersionUID = -1203143214137354429L; @SerializedName("nested1") diff --git a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Properties.java b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Properties.java index 3ba66ce9..e323e8ac 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Properties.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Properties.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +22,7 @@ package org.onap.policy.drools.models.domains.a; import com.google.gson.annotations.SerializedName; +import java.io.Serial; import java.io.Serializable; import lombok.Builder; import lombok.Data; @@ -28,6 +30,7 @@ import lombok.Data; @Data @Builder public class Properties implements Serializable { + @Serial private static final long serialVersionUID = 8476625479607243095L; @SerializedName("nested") diff --git a/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java b/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java index 2c883304..5563d5ea 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/policies/DomainMakerTest.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021 Nordix Foundation. + * Modifications Copyright (C) 2021, 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,17 +22,17 @@ package org.onap.policy.drools.policies; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import com.worldturner.medeia.api.ValidationFailedException; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.drools.models.domains.a.DomainAPolicy; @@ -43,17 +43,17 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; -public class DomainMakerTest { +class DomainMakerTest { private DomainMaker domainMaker; - @Before + @BeforeEach public void setUp() throws Exception { domainMaker = new DomainMaker(); } @Test - public void testIsConformantString() throws IOException { + void testIsConformantString() throws IOException { ToscaConceptIdentifier policyTypeId = new ToscaConceptIdentifier("policy.type.A", "1.0.0"); String rawJsonPolicyType = @@ -66,7 +66,7 @@ public class DomainMakerTest { } @Test - public void testIsConformantToscaPolicy() throws IOException, CoderException { + void testIsConformantToscaPolicy() throws IOException, CoderException { ToscaPolicy policy = getToscaPolicy("src/test/resources/policyA.json"); assertTrue(domainMaker.isConformant(policy)); @@ -75,7 +75,7 @@ public class DomainMakerTest { } @Test - public void testIsDomainConformant() { + void testIsDomainConformant() { ToscaConceptIdentifier policyTypeId = new ToscaConceptIdentifier("policy.type.A", "1.0.0"); @@ -95,7 +95,7 @@ public class DomainMakerTest { @Test - public void testConformance() throws IOException, CoderException { + void testConformance() throws IOException, CoderException { ToscaPolicy policy1 = getToscaPolicy("src/test/resources/policyA.json"); assertTrue(domainMaker.conformance(policy1)); @@ -116,7 +116,7 @@ public class DomainMakerTest { } @Test - public void testRegisterValidator() throws IOException, CoderException { + void testRegisterValidator() throws IOException, CoderException { ToscaConceptIdentifier policyTypeId = new ToscaConceptIdentifier("policy.type.external", "9.9.9"); @@ -133,7 +133,7 @@ public class DomainMakerTest { } @Test - public void testConvertToDomainPolicy() throws IOException, CoderException { + void testConvertToDomainPolicy() throws IOException, CoderException { DomainAPolicy domainAPolicy = domainMaker.convertTo(getToscaPolicy("src/test/resources/policyA.json"), DomainAPolicy.class); assertDomainPolicy(domainAPolicy); @@ -143,7 +143,7 @@ public class DomainMakerTest { } @Test - public void testConvertToSchema() { + void testConvertToSchema() { ToscaPolicyType type = new ToscaPolicyType(); assertThatThrownBy(() -> domainMaker .convertToSchema(type)) @@ -151,7 +151,7 @@ public class DomainMakerTest { } @Test - public void testIsRegistered() { + void testIsRegistered() { ToscaConceptIdentifier policyTypeId1 = new ToscaConceptIdentifier("policy.type.A", "1.0.0"); assertTrue(domainMaker.isRegistered(policyTypeId1)); @@ -189,7 +189,7 @@ public class DomainMakerTest { assertEquals("policy.type.A", domainAPolicy.getType()); assertEquals("A", domainAPolicy.getMetadata().getPolicyId()); assertEquals("nested1", domainAPolicy.getProperties().getNested().getNested1()); - assertEquals(true, domainAPolicy.getProperties().getNested().isNested2()); + assertTrue(domainAPolicy.getProperties().getNested().isNested2()); assertEquals(50, domainAPolicy.getProperties().getNested().getNested3()); } } diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java index c19adea4..f2676e5d 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,20 +21,22 @@ package org.onap.policy.drools.utils; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Arrays; +import java.util.Objects; import java.util.Properties; import java.util.Set; import java.util.TreeSet; import java.util.UUID; import org.apache.commons.lang3.StringUtils; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import org.onap.policy.common.utils.logging.LoggerUtils; import org.onap.policy.common.utils.security.CryptoUtils; import org.slf4j.Logger; @@ -84,7 +87,7 @@ public class PropertyUtilTest { /** * Test Setup -- Create a directory for temporary files. */ - @BeforeClass + @BeforeAll public static void setup() { logger.info("setup: creating a temporary directory"); @@ -96,15 +99,15 @@ public class PropertyUtilTest { /** * Test Cleanup -- Remove temporary files. */ - @AfterClass + @AfterAll public static void teardown() { logger.info("teardown: remove the temporary directory"); // the assumption is that we only have one level of temporary files - for (File file : directory.listFiles()) { - file.delete(); + for (File file : Objects.requireNonNull(directory.listFiles())) { + assertTrue(file.delete()); } - directory.delete(); + assertTrue(directory.delete()); } /** @@ -153,7 +156,7 @@ public class PropertyUtilTest { * Test the basic properties file interface. */ @Test - public void testGetProperties() throws Exception { + void testGetProperties() throws Exception { logger.info("testGetProperties: test the basic properties file interface"); // copy system properties @@ -253,7 +256,7 @@ public class PropertyUtilTest { * This tests the 'PropertyUtil.Listener' interface. */ @Test - public void testListenerInterface() throws Exception { + void testListenerInterface() throws Exception { logger.info("testListenerInterface: test receipt of dynamic updates"); // create initial property file diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/ReferenceTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/ReferenceTest.java index 8afe4626..c8c08d9d 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/utils/ReferenceTest.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/ReferenceTest.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,17 +21,17 @@ package org.onap.policy.drools.utils; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class ReferenceTest { +class ReferenceTest { @Test - public void testReference() { + void testReference() { Reference<Integer> val = new Reference<>(null); assertNull(val.get()); @@ -39,7 +40,7 @@ public class ReferenceTest { } @Test - public void testGet_testSet() { + void testGet_testSet() { Reference<Integer> val = new Reference<>(null); assertNull(val.get()); @@ -51,7 +52,7 @@ public class ReferenceTest { } @Test - public void testCompareAndSet() { + void testCompareAndSet() { Reference<Integer> val = new Reference<>(null); Integer valCompare = 100; diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java index b7feaf06..cd1aac43 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/ReflectionUtilTest.java @@ -3,6 +3,7 @@ * policy-utils * ================================================================================ * Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,26 +21,27 @@ package org.onap.policy.drools.utils; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; -import org.junit.Test; +import org.junit.jupiter.api.Test; -public class ReflectionUtilTest { +class ReflectionUtilTest { public class ParentClass { } - public class ChildClass extends ParentClass{ + class ChildClass extends ParentClass{ } @Test - public void testReflection() { + void testReflection() { try { @@ -61,25 +63,27 @@ public class ReflectionUtilTest { } } - @Test(expected = IllegalArgumentException.class) - public void testException1() { - ReflectionUtil.fetchClass(null, "org.onap.policy.drools.utils.ReflectionUtil"); + @Test + void testException1() { + assertThrows(IllegalArgumentException.class, () -> + ReflectionUtil.fetchClass(null, "org.onap.policy.drools.utils.ReflectionUtil")); } - @Test(expected = IllegalArgumentException.class) - public void testException2() { + @Test + void testException2() { Class<?> class1; try { class1 = Class.forName("org.onap.policy.drools.utils.ReflectionUtil"); ClassLoader classLoader = class1.getClassLoader(); - ReflectionUtil.fetchClass(classLoader, null); + assertThrows(IllegalArgumentException.class, () -> + ReflectionUtil.fetchClass(classLoader, null)); } catch (ClassNotFoundException e) { fail(); } } @Test - public void testException3() throws ClassNotFoundException { + void testException3() { assertNull(ReflectionUtil.fetchClass(ClassLoader.getSystemClassLoader(), "foo.bar")); } } diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/LoggerUtilTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/LoggerUtilTest.java index 195a7add..524d46e4 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/LoggerUtilTest.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/LoggerUtilTest.java @@ -3,6 +3,7 @@ * policy-utils * ================================================================================ * Copyright (C) 2018, 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,18 +21,18 @@ package org.onap.policy.drools.utils.logging; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.onap.policy.common.utils.logging.LoggerUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class LoggerUtilTest { +class LoggerUtilTest { @Test - public void test() { + void test() { Logger logger = LoggerFactory.getLogger(LoggerUtilTest.class); diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java index 213c1c6e..2beddcc3 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/logging/MdcTransactionTest.java @@ -3,6 +3,7 @@ * policy-utils * ================================================================================ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,20 +20,20 @@ package org.onap.policy.drools.utils.logging; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import java.time.Duration; import java.time.Instant; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.MDC; -public class MdcTransactionTest { +class MdcTransactionTest { @Test - public void testResetSubTransaction() { + void testResetSubTransaction() { MdcTransaction trans = MdcTransaction.newTransaction(null, null).resetSubTransaction(); @@ -88,7 +89,7 @@ public class MdcTransactionTest { private void assertNullKeys(String... nullKeys) { for (String key: nullKeys) { - assertNull(key, MDC.get(key)); + assertNull(MDC.get(key)); } } @@ -126,7 +127,7 @@ public class MdcTransactionTest { } @Test - public void testFlush() { + void testFlush() { MdcTransaction trans = MdcTransaction.newTransaction() .setRequestId(null) @@ -198,12 +199,12 @@ public class MdcTransactionTest { } private void assertKeyEquals(String expected, String transValue, String mdcKey) { - assertEquals("trans." + expected, expected, transValue); - assertEquals("mdc." + expected, expected, MDC.get(mdcKey)); + assertEquals(expected, transValue, "trans." + expected); + assertEquals(expected, MDC.get(mdcKey), "mdc." + expected); } @Test - public void testMetric() { + void testMetric() { MdcTransaction trans = MdcTransaction.newTransaction(null, null).metric(); @@ -211,7 +212,7 @@ public class MdcTransactionTest { } @Test - public void testTransaction() { + void testTransaction() { MdcTransaction trans = MdcTransaction.newTransaction(null, null).transaction(); @@ -219,7 +220,7 @@ public class MdcTransactionTest { } @Test - public void testSubTransaction() { + void testSubTransaction() { MdcTransaction trans = MdcTransaction.newTransaction(null, "partner"); |