diff --git a/framework-platform/framework-platform.gradle b/framework-platform/framework-platform.gradle index e4152e7d6dcf..e03441a25a5e 100644 --- a/framework-platform/framework-platform.gradle +++ b/framework-platform/framework-platform.gradle @@ -131,7 +131,7 @@ dependencies { api("org.hsqldb:hsqldb:2.7.2") api("org.javamoney:moneta:1.4.2") api("org.jruby:jruby:9.4.5.0") - api("org.junit.support:testng-engine:1.0.4") + api("org.junit.support:testng-engine:1.0.5") api("org.mozilla:rhino:1.7.14") api("org.ogce:xpp3:1.1.6") api("org.python:jython-standalone:2.7.3") diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTestNGSpringContextTests.java index f334fb4f110e..54ff22b866cf 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTestNGSpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ * @since 5.1 */ @ContextConfiguration -public class AnnotationConfigTestNGSpringContextTests extends AbstractTestNGSpringContextTests { +class AnnotationConfigTestNGSpringContextTests extends AbstractTestNGSpringContextTests { @Autowired Employee employee; @@ -48,7 +48,7 @@ public class AnnotationConfigTestNGSpringContextTests extends AbstractTestNGSpri Pet pet; @Test - public void autowiringFromConfigClass() { + void autowiringFromConfigClass() { assertThat(employee).as("The employee should have been autowired.").isNotNull(); assertThat(employee.getName()).isEqualTo("John Smith"); diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java index aeb8fc244544..b4270bff7bc4 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/AnnotationConfigTransactionalTestNGSpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ * @since 3.1 */ @ContextConfiguration -public class AnnotationConfigTransactionalTestNGSpringContextTests +class AnnotationConfigTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests { private static final String JANE = "jane"; @@ -112,7 +112,7 @@ void afterClass() { @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void autowiringFromConfigClass() { + void autowiringFromConfigClass() { assertThat(employee).as("The employee should have been autowired.").isNotNull(); assertThat(employee.getName()).isEqualTo("John Smith"); @@ -136,7 +136,7 @@ void setUp() throws Exception { } @Test - public void modifyTestDataWithinTransaction() { + void modifyTestDataWithinTransaction() { assertThatTransaction().isActive(); assertAddPerson(JANE); assertAddPerson(SUE); diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java index 4c66679a8432..c1786a72216d 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/ConcreteTransactionalTestNGSpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ * @since 2.5 */ @ContextConfiguration -public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests +class ConcreteTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests implements BeanNameAware, InitializingBean { private static final String JANE = "jane"; @@ -150,7 +150,7 @@ void afterTransaction() { @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void verifyBeanNameSet() { + void verifyBeanNameSet() { assertThatTransaction().isNotActive(); assertThat(this.beanName) .as("The bean name of this test instance should have been set to the fully qualified class name due to BeanNameAware semantics.") @@ -159,7 +159,7 @@ public void verifyBeanNameSet() { @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void verifyApplicationContextSet() { + void verifyApplicationContextSet() { assertThatTransaction().isNotActive(); assertThat(super.applicationContext) .as("The application context should have been set due to ApplicationContextAware semantics.") @@ -170,7 +170,7 @@ public void verifyApplicationContextSet() { @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void verifyBeanInitialized() { + void verifyBeanInitialized() { assertThatTransaction().isNotActive(); assertThat(beanInitialized) .as("This test instance should have been initialized due to InitializingBean semantics.") @@ -179,7 +179,7 @@ public void verifyBeanInitialized() { @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void verifyAnnotationAutowiredFields() { + void verifyAnnotationAutowiredFields() { assertThatTransaction().isNotActive(); assertThat(nonrequiredLong).as("The nonrequiredLong field should NOT have been autowired.").isNull(); assertThat(pet).as("The pet field should have been autowired.").isNotNull(); @@ -188,7 +188,7 @@ public void verifyAnnotationAutowiredFields() { @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void verifyAnnotationAutowiredMethods() { + void verifyAnnotationAutowiredMethods() { assertThatTransaction().isNotActive(); assertThat(employee).as("The setEmployee() method should have been autowired.").isNotNull(); assertThat(employee.getName()).as("employee's name.").isEqualTo("John Smith"); @@ -196,20 +196,20 @@ public void verifyAnnotationAutowiredMethods() { @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void verifyResourceAnnotationInjectedFields() { + void verifyResourceAnnotationInjectedFields() { assertThatTransaction().isNotActive(); assertThat(foo).as("The foo field should have been injected via @Resource.").isEqualTo("Foo"); } @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void verifyResourceAnnotationInjectedMethods() { + void verifyResourceAnnotationInjectedMethods() { assertThatTransaction().isNotActive(); assertThat(bar).as("The setBar() method should have been injected via @Resource.").isEqualTo("Bar"); } @Test - public void modifyTestDataWithinTransaction() { + void modifyTestDataWithinTransaction() { assertThatTransaction().isActive(); assertAddPerson(JANE); assertAddPerson(SUE); diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java index 300a9cc9f19d..1a49a60f568d 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/DirtiesContextTransactionalTestNGSpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ * @since 2.5 */ @ContextConfiguration -public class DirtiesContextTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests { +class DirtiesContextTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests { private ApplicationContext dirtiedApplicationContext; @@ -64,13 +64,13 @@ private void performCommonAssertions() { @Test @DirtiesContext - public void dirtyContext() { + void dirtyContext() { performCommonAssertions(); this.dirtiedApplicationContext = super.applicationContext; } @Test(dependsOnMethods = { "dirtyContext" }) - public void verifyContextWasDirtied() { + void verifyContextWasDirtied() { performCommonAssertions(); assertThat(super.applicationContext) .as("The application context should have been 'dirtied'.") @@ -79,7 +79,7 @@ public void verifyContextWasDirtied() { } @Test(dependsOnMethods = { "verifyContextWasDirtied" }) - public void verifyContextWasNotDirtied() { + void verifyContextWasNotDirtied() { assertThat(this.applicationContext) .as("The application context should NOT have been 'dirtied'.") .isSameAs(this.dirtiedApplicationContext); diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/TimedTransactionalTestNGSpringContextTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/TimedTransactionalTestNGSpringContextTests.java index 0d0ff990b751..171ddeae2767 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/TimedTransactionalTestNGSpringContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/TimedTransactionalTestNGSpringContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,16 +32,16 @@ * @since 3.0 */ @ContextConfiguration -public class TimedTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests { +class TimedTransactionalTestNGSpringContextTests extends AbstractTransactionalTestNGSpringContextTests { @Test - public void testWithoutTimeout() { + void testWithoutTimeout() { assertThatTransaction().isActive(); } // TODO Enable TestNG test with timeout once we have a solution. @Test(timeOut = 10000, enabled = false) - public void testWithTimeout() { + void testWithTimeout() { assertThatTransaction().isActive(); } diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsAsyncIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsAsyncIntegrationTests.java index 140fbe0f888a..79f60addd13d 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsAsyncIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsAsyncIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ class TestNGApplicationEventsAsyncIntegrationTests extends AbstractTestNGSpringC @Test - public void asyncPublication() throws InterruptedException { + void asyncPublication() throws InterruptedException { Thread t = new Thread(() -> context.publishEvent(new CustomEvent("asyncPublication"))); t.start(); t.join(); @@ -61,7 +61,7 @@ public void asyncPublication() throws InterruptedException { } @Test - public void asyncConsumption() { + void asyncConsumption() { context.publishEvent(new CustomEvent("asyncConsumption")); Awaitility.await().atMost(Durations.ONE_SECOND) diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsIntegrationTests.java index 67748d840947..0e359e0796a0 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/event/TestNGApplicationEventsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,12 +72,12 @@ void beforeEach() { } @Test - public void test1() { + void test1() { assertTestExpectations("test1"); } @Test - public void test2() { + void test2() { assertTestExpectations("test2"); } diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/AbstractEjbTxDaoTestNGTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/AbstractEjbTxDaoTestNGTests.java index 3b56ad3f3298..491b17f33c70 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/AbstractEjbTxDaoTestNGTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/AbstractEjbTxDaoTestNGTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ * @since 4.0.1 */ @DirtiesContext(classMode = ClassMode.AFTER_CLASS) -public abstract class AbstractEjbTxDaoTestNGTests extends AbstractTransactionalTestNGSpringContextTests { +abstract class AbstractEjbTxDaoTestNGTests extends AbstractTransactionalTestNGSpringContextTests { protected static final String TEST_NAME = "test-name"; @@ -50,13 +50,13 @@ public abstract class AbstractEjbTxDaoTestNGTests extends AbstractTransactionalT @Test - public void test1InitialState() { + void test1InitialState() { int count = dao.getCount(TEST_NAME); assertThat(count).as("New TestEntity should have count=0.").isEqualTo(0); } @Test(dependsOnMethods = "test1InitialState") - public void test2IncrementCount1() { + void test2IncrementCount1() { int count = dao.incrementCount(TEST_NAME); assertThat(count).as("Expected count=1 after first increment.").isEqualTo(1); } @@ -67,7 +67,7 @@ public void test2IncrementCount1() { * expected that the previous increment has been persisted in the database. */ @Test(dependsOnMethods = "test2IncrementCount1") - public void test3IncrementCount2() { + void test3IncrementCount2() { int count = dao.getCount(TEST_NAME); assertThat(count).as("Expected count=1 after test2IncrementCount1().").isEqualTo(1); @@ -76,7 +76,7 @@ public void test3IncrementCount2() { } @AfterMethod(alwaysRun = true) - public void synchronizePersistenceContext() { + void synchronizePersistenceContext() { em.flush(); } diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/CommitForRequiredEjbTxDaoTestNGTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/CommitForRequiredEjbTxDaoTestNGTests.java index 4ca7ebea2b43..ed23e15b69fe 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/CommitForRequiredEjbTxDaoTestNGTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/CommitForRequiredEjbTxDaoTestNGTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ @Test(suiteName = "Commit for REQUIRED") @ContextConfiguration("/org/springframework/test/context/transaction/ejb/required-tx-config.xml") @Commit -public class CommitForRequiredEjbTxDaoTestNGTests extends AbstractEjbTxDaoTestNGTests { +class CommitForRequiredEjbTxDaoTestNGTests extends AbstractEjbTxDaoTestNGTests { /* test methods in superclass */ diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/CommitForRequiresNewEjbTxDaoTestNGTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/CommitForRequiresNewEjbTxDaoTestNGTests.java index c79df3dc56b1..08ce4a285365 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/CommitForRequiresNewEjbTxDaoTestNGTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/CommitForRequiresNewEjbTxDaoTestNGTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ @Test(suiteName = "Commit for REQUIRES_NEW") @ContextConfiguration("/org/springframework/test/context/transaction/ejb/requires-new-tx-config.xml") @Commit -public class CommitForRequiresNewEjbTxDaoTestNGTests extends AbstractEjbTxDaoTestNGTests { +class CommitForRequiresNewEjbTxDaoTestNGTests extends AbstractEjbTxDaoTestNGTests { /* test methods in superclass */ diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/RollbackForRequiredEjbTxDaoTestNGTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/RollbackForRequiredEjbTxDaoTestNGTests.java index 138b2aa9af70..df735ca63881 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/RollbackForRequiredEjbTxDaoTestNGTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/RollbackForRequiredEjbTxDaoTestNGTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ */ @Test(suiteName = "Rollback for REQUIRED") @Rollback -public class RollbackForRequiredEjbTxDaoTestNGTests extends CommitForRequiredEjbTxDaoTestNGTests { +class RollbackForRequiredEjbTxDaoTestNGTests extends CommitForRequiredEjbTxDaoTestNGTests { /** * Overrides parent implementation in order to change expectations to align with @@ -46,7 +46,7 @@ public class RollbackForRequiredEjbTxDaoTestNGTests extends CommitForRequiredEjb */ @Test(dependsOnMethods = "test2IncrementCount1") @Override - public void test3IncrementCount2() { + void test3IncrementCount2() { int count = dao.getCount(TEST_NAME); // Expecting count=0 after test2IncrementCount1() since REQUIRED transactions // participate in the existing transaction (if present), which in this case is the diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/RollbackForRequiresNewEjbTxDaoTestNGTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/RollbackForRequiresNewEjbTxDaoTestNGTests.java index b4063beee244..2504001748a4 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/RollbackForRequiresNewEjbTxDaoTestNGTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/transaction/ejb/RollbackForRequiresNewEjbTxDaoTestNGTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ */ @Test(suiteName = "Rollback for REQUIRES_NEW") @Rollback -public class RollbackForRequiresNewEjbTxDaoTestNGTests extends CommitForRequiresNewEjbTxDaoTestNGTests { +class RollbackForRequiresNewEjbTxDaoTestNGTests extends CommitForRequiresNewEjbTxDaoTestNGTests { /* test methods in superclass */ diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/transaction/programmatic/ProgrammaticTxMgmtTestNGTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/transaction/programmatic/ProgrammaticTxMgmtTestNGTests.java index 1413e41a7426..8230dc0af193 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/transaction/programmatic/ProgrammaticTxMgmtTestNGTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/transaction/programmatic/ProgrammaticTxMgmtTestNGTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ * @since 4.1 */ @ContextConfiguration -public class ProgrammaticTxMgmtTestNGTests extends AbstractTransactionalTestNGSpringContextTests { +class ProgrammaticTxMgmtTestNGTests extends AbstractTransactionalTestNGSpringContextTests { private String methodName; @@ -65,13 +65,13 @@ public void run(IHookCallBack callBack, ITestResult testResult) { } @BeforeTransaction - public void beforeTransaction() { + void beforeTransaction() { deleteFromTables("user"); executeSqlScript("classpath:/org/springframework/test/context/jdbc/data.sql", false); } @AfterTransaction - public void afterTransaction() { + void afterTransaction() { switch (this.methodName) { case "commitTxAndStartNewTx", "commitTxButDoNotStartNewTx" -> assertUsers("Dogbert"); case "rollbackTxAndStartNewTx", "rollbackTxButDoNotStartNewTx", "startTxWithExistingTransaction" -> @@ -83,47 +83,47 @@ public void afterTransaction() { @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void isActiveWithNonExistentTransactionContext() { + void isActiveWithNonExistentTransactionContext() { assertThat(TestTransaction.isActive()).isFalse(); } @Test(expectedExceptions = IllegalStateException.class) @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void flagForRollbackWithNonExistentTransactionContext() { + void flagForRollbackWithNonExistentTransactionContext() { TestTransaction.flagForRollback(); } @Test(expectedExceptions = IllegalStateException.class) @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void flagForCommitWithNonExistentTransactionContext() { + void flagForCommitWithNonExistentTransactionContext() { TestTransaction.flagForCommit(); } @Test(expectedExceptions = IllegalStateException.class) @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void isFlaggedForRollbackWithNonExistentTransactionContext() { + void isFlaggedForRollbackWithNonExistentTransactionContext() { TestTransaction.isFlaggedForRollback(); } @Test(expectedExceptions = IllegalStateException.class) @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void startTxWithNonExistentTransactionContext() { + void startTxWithNonExistentTransactionContext() { TestTransaction.start(); } @Test(expectedExceptions = IllegalStateException.class) - public void startTxWithExistingTransaction() { + void startTxWithExistingTransaction() { TestTransaction.start(); } @Test(expectedExceptions = IllegalStateException.class) @Transactional(propagation = Propagation.NOT_SUPPORTED) - public void endTxWithNonExistentTransactionContext() { + void endTxWithNonExistentTransactionContext() { TestTransaction.end(); } @Test - public void commitTxAndStartNewTx() { + void commitTxAndStartNewTx() { assertThatTransaction().isActive(); assertThat(TestTransaction.isActive()).isTrue(); assertUsers("Dilbert"); @@ -147,7 +147,7 @@ public void commitTxAndStartNewTx() { } @Test - public void commitTxButDoNotStartNewTx() { + void commitTxButDoNotStartNewTx() { assertThatTransaction().isActive(); assertThat(TestTransaction.isActive()).isTrue(); assertUsers("Dilbert"); @@ -167,7 +167,7 @@ public void commitTxButDoNotStartNewTx() { } @Test - public void rollbackTxAndStartNewTx() { + void rollbackTxAndStartNewTx() { assertThatTransaction().isActive(); assertThat(TestTransaction.isActive()).isTrue(); assertUsers("Dilbert"); @@ -192,7 +192,7 @@ public void rollbackTxAndStartNewTx() { } @Test - public void rollbackTxButDoNotStartNewTx() { + void rollbackTxButDoNotStartNewTx() { assertThatTransaction().isActive(); assertThat(TestTransaction.isActive()).isTrue(); assertUsers("Dilbert"); @@ -209,7 +209,7 @@ public void rollbackTxButDoNotStartNewTx() { @Test @Commit - public void rollbackTxAndStartNewTxWithDefaultCommitSemantics() { + void rollbackTxAndStartNewTxWithDefaultCommitSemantics() { assertThatTransaction().isActive(); assertThat(TestTransaction.isActive()).isTrue(); assertUsers("Dilbert"); @@ -251,12 +251,12 @@ private void assertUsers(String... users) { static class Config { @Bean - public PlatformTransactionManager transactionManager() { + PlatformTransactionManager transactionManager() { return new DataSourceTransactionManager(dataSource()); } @Bean - public DataSource dataSource() { + DataSource dataSource() { return new EmbeddedDatabaseBuilder() .generateUniqueName(true) .addScript("classpath:/org/springframework/test/context/jdbc/schema.sql") diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/web/ServletTestExecutionListenerTestNGIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/web/ServletTestExecutionListenerTestNGIntegrationTests.java index 6602f00caf4d..b87120fc9f89 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/web/ServletTestExecutionListenerTestNGIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/web/ServletTestExecutionListenerTestNGIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ */ @ContextConfiguration @WebAppConfiguration -public class ServletTestExecutionListenerTestNGIntegrationTests extends AbstractTestNGSpringContextTests { +class ServletTestExecutionListenerTestNGIntegrationTests extends AbstractTestNGSpringContextTests { @Configuration static class Config { @@ -57,7 +57,7 @@ static class Config { * @see #ensureMocksAreReinjectedBetweenTests_2 */ @Test - public void ensureMocksAreReinjectedBetweenTests_1() { + void ensureMocksAreReinjectedBetweenTests_1() { assertInjectedServletRequestEqualsRequestInRequestContextHolder(); } @@ -67,7 +67,7 @@ public void ensureMocksAreReinjectedBetweenTests_1() { * @see #ensureMocksAreReinjectedBetweenTests_1 */ @Test - public void ensureMocksAreReinjectedBetweenTests_2() { + void ensureMocksAreReinjectedBetweenTests_2() { assertInjectedServletRequestEqualsRequestInRequestContextHolder(); } diff --git a/spring-test/src/test/java/org/springframework/test/context/testng/web/TestNGSpringContextWebTests.java b/spring-test/src/test/java/org/springframework/test/context/testng/web/TestNGSpringContextWebTests.java index ef594782d7bc..311a9ecda561 100644 --- a/spring-test/src/test/java/org/springframework/test/context/testng/web/TestNGSpringContextWebTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/testng/web/TestNGSpringContextWebTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ */ @ContextConfiguration @WebAppConfiguration -public class TestNGSpringContextWebTests extends AbstractTestNGSpringContextTests implements ServletContextAware { +class TestNGSpringContextWebTests extends AbstractTestNGSpringContextTests implements ServletContextAware { @Configuration static class Config { @@ -88,7 +88,7 @@ public void setServletContext(ServletContext servletContext) { } @Test - public void basicWacFeatures() throws Exception { + void basicWacFeatures() throws Exception { assertThat(wac.getServletContext()).as("ServletContext should be set in the WAC.").isNotNull(); assertThat(servletContext).as("ServletContext should have been set via ServletContextAware.").isNotNull(); @@ -113,7 +113,7 @@ public void basicWacFeatures() throws Exception { } @Test - public void fooEnigmaAutowired() { + void fooEnigmaAutowired() { assertThat(foo).isEqualTo("enigma"); }