From db65955fc93a81911ef66ab88b380dc1a5926dce Mon Sep 17 00:00:00 2001 From: vasraz Date: Fri, 19 Feb 2021 19:04:13 +0000 Subject: Fix BLOCKER BUGs reported by Sonar Signed-off-by: Vasyl Razinkov Change-Id: I00c466ac3fcbe8fab4629aed3a36bb2d8af3a970 Issue-ID: SDC-3472 --- .../artifacts/ArtifactValidationUtilsTest.java | 30 ++-- .../migration/core/SdcMigrationToolTest.java | 179 ++++++++++----------- .../resolver/SpringBeansMigrationResolverTest.java | 156 +++++++++--------- .../migration/service/SdcRepoServiceTest.java | 35 ++-- .../tasks/mig1806/ForwardPathMigrationTest.java | 49 +++--- 5 files changed, 222 insertions(+), 227 deletions(-) (limited to 'asdctool/src/test') diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java index 26ad7d8e20..58ce1979f2 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/artifacts/ArtifactValidationUtilsTest.java @@ -38,6 +38,7 @@ import java.util.List; import java.util.Map; import java.util.stream.IntStream; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -55,13 +56,21 @@ import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; public class ArtifactValidationUtilsTest { + private static final String ES_ID = "testEsInCassandra"; + private static final String ES_ID_NOT_IN_CASS = "testEsNotInCassandra"; + private static final String TASK_NAME = "testTaskName"; + private static final String UNIQUE_ID = "4321"; + private static final String UNIQUE_ID_VERTEX = "321"; + private static final String resourcePath = new File("src/test/resources").getAbsolutePath(); + private static final String txtReportFilePath = ValidationConfigManager.txtReportFilePath(resourcePath); + + @InjectMocks + private ArtifactValidationUtils testSubject; + @Mock private ArtifactCassandraDao artifactCassandraDao; @Mock private TopologyTemplateOperation topologyTemplateOperation; - @InjectMocks - private ArtifactValidationUtils testSubject; - @Mock private GraphVertex vertex; @Mock @@ -75,20 +84,11 @@ public class ArtifactValidationUtilsTest { @Mock private TopologyTemplate topologyTemplate; - private static final String ES_ID = "testEsInCassandra"; - private static final String ES_ID_NOT_IN_CASS = "testEsNotInCassandra"; - private static final String TASK_NAME = "testTaskName"; - private static final String UNIQUE_ID = "4321"; - private static final String UNIQUE_ID_VERTEX = "321"; - - private final static String resourcePath = new File("src/test/resources").getAbsolutePath(); - private final static String txtReportFilePath = ValidationConfigManager.txtReportFilePath(resourcePath); - - ArtifactValidationUtilsTest () { + @BeforeEach + public void initMocks() { MockitoAnnotations.initMocks(this); when(artifactCassandraDao.getCountOfArtifactById(ES_ID)).thenReturn(Either.left(1L)); - when(artifactCassandraDao.getCountOfArtifactById(ES_ID_NOT_IN_CASS)) - .thenReturn(Either.right(CassandraOperationStatus.NOT_FOUND)); + when(artifactCassandraDao.getCountOfArtifactById(ES_ID_NOT_IN_CASS)).thenReturn(Either.right(CassandraOperationStatus.NOT_FOUND)); when(artifactDataDefinition.getEsId()).thenReturn(ES_ID); when(artifactDataDefinitionNotInCassandra.getEsId()).thenReturn(ES_ID_NOT_IN_CASS); diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/SdcMigrationToolTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/SdcMigrationToolTest.java index a9172a331b..882e685ebe 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/SdcMigrationToolTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/core/SdcMigrationToolTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,103 +20,98 @@ package org.openecomp.sdc.asdctool.migration.core; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Arrays; +import java.util.Collections; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; import org.mockito.internal.verification.Times; +import org.mockito.junit.jupiter.MockitoExtension; import org.openecomp.sdc.asdctool.migration.core.task.Migration; import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; import org.openecomp.sdc.asdctool.migration.resolver.MigrationResolver; import org.openecomp.sdc.asdctool.migration.service.SdcRepoService; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.util.Arrays; -import java.util.Collections; - -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -public class SdcMigrationToolTest { - - @InjectMocks - private SdcMigrationTool testInstance = spy(SdcMigrationTool.class); - - @Mock - private MigrationResolver migrationResolverMock; - - @Mock - private SdcRepoService sdcRepoServiceMock; - - @BeforeMethod - public void setUp() { - MockitoAnnotations.initMocks(this); - } - - @Test - public void testMigrate_noMigrations() { - when(migrationResolverMock.resolveMigrations()).thenReturn(Collections.emptyList()); - testInstance.migrate(false); - verify(sdcRepoServiceMock, new Times(0)).clearTasksForCurrentMajor(); - verify(sdcRepoServiceMock, new Times(0)).createMigrationTask(Mockito.any()); - } - - @Test - public void testMigrate_enforceFlag_removeAllMigrationTasksForCurrentVersion() { - when(migrationResolverMock.resolveMigrations()).thenReturn(Collections.emptyList()); - testInstance.migrate(true); - verify(sdcRepoServiceMock, new Times(1)).clearTasksForCurrentMajor(); - } - - @Test - public void testMigrate_stopAfterFirstFailure() { - when(migrationResolverMock.resolveMigrations()) - .thenReturn(Arrays.asList(new SuccessfulMigration(), new FailedMigration(), new SuccessfulMigration())); - testInstance.migrate(false); - verify(sdcRepoServiceMock, new Times(0)).clearTasksForCurrentMajor(); - verify(sdcRepoServiceMock, new Times(1)).createMigrationTask(Mockito.any()); - - } - - private class FailedMigration implements Migration { - - @Override - public String description() { - return null; - } - - @Override - public DBVersion getVersion() { - return DBVersion.fromString("1710.22"); - } - - @Override - public MigrationResult migrate() { - MigrationResult migrationResult = new MigrationResult(); - migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.FAILED); - return migrationResult; - } - } - - private class SuccessfulMigration implements Migration { - - @Override - public String description() { - return null; - } - - @Override - public DBVersion getVersion() { - return DBVersion.fromString("1710.22"); - } - - @Override - public MigrationResult migrate() { - MigrationResult migrationResult = new MigrationResult(); - migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.COMPLETED); - return migrationResult; - } - } +@ExtendWith(MockitoExtension.class) +class SdcMigrationToolTest { + + @InjectMocks + private SdcMigrationTool testInstance = spy(SdcMigrationTool.class); + + @Mock + private MigrationResolver migrationResolverMock; + + @Mock + private SdcRepoService sdcRepoServiceMock; + + @Test + void testMigrate_noMigrations() { + when(migrationResolverMock.resolveMigrations()).thenReturn(Collections.emptyList()); + testInstance.migrate(false); + verify(sdcRepoServiceMock, new Times(0)).clearTasksForCurrentMajor(); + verify(sdcRepoServiceMock, new Times(0)).createMigrationTask(Mockito.any()); + } + + @Test + void testMigrate_enforceFlag_removeAllMigrationTasksForCurrentVersion() { + when(migrationResolverMock.resolveMigrations()).thenReturn(Collections.emptyList()); + testInstance.migrate(true); + verify(sdcRepoServiceMock, new Times(1)).clearTasksForCurrentMajor(); + } + + @Test + void testMigrate_stopAfterFirstFailure() { + when(migrationResolverMock.resolveMigrations()) + .thenReturn(Arrays.asList(new SuccessfulMigration(), new FailedMigration(), new SuccessfulMigration())); + testInstance.migrate(false); + verify(sdcRepoServiceMock, new Times(0)).clearTasksForCurrentMajor(); + verify(sdcRepoServiceMock, new Times(1)).createMigrationTask(Mockito.any()); + + } + + private class FailedMigration implements Migration { + + @Override + public String description() { + return null; + } + + @Override + public DBVersion getVersion() { + return DBVersion.fromString("1710.22"); + } + + @Override + public MigrationResult migrate() { + MigrationResult migrationResult = new MigrationResult(); + migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.FAILED); + return migrationResult; + } + } + + private class SuccessfulMigration implements Migration { + + @Override + public String description() { + return null; + } + + @Override + public DBVersion getVersion() { + return DBVersion.fromString("1710.22"); + } + + @Override + public MigrationResult migrate() { + MigrationResult migrationResult = new MigrationResult(); + migrationResult.setMigrationStatus(MigrationResult.MigrationStatus.COMPLETED); + return migrationResult; + } + } } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolverTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolverTest.java index ffccc4d9c2..a169e6f752 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolverTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/resolver/SpringBeansMigrationResolverTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,9 +20,20 @@ package org.openecomp.sdc.asdctool.migration.resolver; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.MockitoAnnotations; +import org.mockito.junit.jupiter.MockitoExtension; import org.openecomp.sdc.asdctool.migration.core.DBVersion; import org.openecomp.sdc.asdctool.migration.core.task.IMigrationStage; import org.openecomp.sdc.asdctool.migration.core.task.Migration; @@ -30,85 +41,74 @@ import org.openecomp.sdc.asdctool.migration.core.task.MigrationResult; import org.openecomp.sdc.asdctool.migration.dao.MigrationTasksDao; import org.openecomp.sdc.asdctool.migration.service.SdcRepoService; import org.openecomp.sdc.be.dao.cassandra.CassandraClient; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -public class SpringBeansMigrationResolverTest { +@ExtendWith(MockitoExtension.class) +class SpringBeansMigrationResolverTest { - @InjectMocks - private SpringBeansMigrationResolver testInstance; + @InjectMocks + private SpringBeansMigrationResolver testInstance; - @Mock - private SdcRepoService sdcRepoServiceMock; + @Mock + private SdcRepoService sdcRepoServiceMock; - private List migrations = Arrays.asList(createMigration("1710.1"), createMigration("1710.22"), - createMigration("1707.12"), createMigration("1710.3")); + private List migrations = Arrays.asList(createMigration("1710.1"), createMigration("1710.22"), + createMigration("1707.12"), createMigration("1710.3")); - @BeforeMethod + @BeforeEach public void setUp() { - MockitoAnnotations.initMocks(this); - testInstance.setMigrations(migrations); - } - - @Test - public void testResolveMigrations_getMigrationsWithVersionGreaterThanLatest() { - when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.2")); - testInstance.setPostMigrations(Collections.emptyList()); - List resolvedMigrations = testInstance.resolveMigrations(); - assertEquals(resolvedMigrations.size(), 2); - assertEquals(resolvedMigrations.get(0).getVersion(), DBVersion.fromString("1710.3")); - assertEquals(resolvedMigrations.get(1).getVersion(), DBVersion.fromString("1710.22")); - } - - @Test - public void testResolveMigration_noLatestVersionForCurrentMajorVersion() { - when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.-1")); - testInstance.setPostMigrations(Collections.emptyList()); - List resolvedMigrations = testInstance.resolveMigrations(); - assertEquals(resolvedMigrations.size(), 3); - assertEquals(resolvedMigrations.get(0).getVersion(), DBVersion.fromString("1710.1")); - assertEquals(resolvedMigrations.get(1).getVersion(), DBVersion.fromString("1710.3")); - assertEquals(resolvedMigrations.get(2).getVersion(), DBVersion.fromString("1710.22")); - } - - @Test - public void testResolveMigrations_emptyMigrationsList() { - testInstance.setMigrations(Collections.emptyList()); - testInstance.setPostMigrations(Collections.emptyList()); - when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.-1")); - List resolvedMigrations = testInstance.resolveMigrations(); - assertTrue(resolvedMigrations.isEmpty()); - } - - private Migration createMigration(String version) { - return new Migration() { - @Override - public String description() { - return null; - } - - @Override - public DBVersion getVersion() { - return DBVersion.fromString(version); - } - - @Override - public MigrationResult migrate() { - return null; - } - }; - } - - private SpringBeansMigrationResolver createTestSubject() { - return new SpringBeansMigrationResolver(null, null, new SdcRepoService(new MigrationTasksDao(mock(CassandraClient.class)))); - } + testInstance.setMigrations(migrations); + } + + @Test + void testResolveMigrations_getMigrationsWithVersionGreaterThanLatest() { + when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.2")); + testInstance.setPostMigrations(Collections.emptyList()); + List resolvedMigrations = testInstance.resolveMigrations(); + assertEquals(resolvedMigrations.size(), 2); + assertEquals(resolvedMigrations.get(0).getVersion(), DBVersion.fromString("1710.3")); + assertEquals(resolvedMigrations.get(1).getVersion(), DBVersion.fromString("1710.22")); + } + + @Test + void testResolveMigration_noLatestVersionForCurrentMajorVersion() { + when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.-1")); + testInstance.setPostMigrations(Collections.emptyList()); + List resolvedMigrations = testInstance.resolveMigrations(); + assertEquals(resolvedMigrations.size(), 3); + assertEquals(resolvedMigrations.get(0).getVersion(), DBVersion.fromString("1710.1")); + assertEquals(resolvedMigrations.get(1).getVersion(), DBVersion.fromString("1710.3")); + assertEquals(resolvedMigrations.get(2).getVersion(), DBVersion.fromString("1710.22")); + } + + @Test + void testResolveMigrations_emptyMigrationsList() { + testInstance.setMigrations(Collections.emptyList()); + testInstance.setPostMigrations(Collections.emptyList()); + when(sdcRepoServiceMock.getLatestDBVersion()).thenReturn(DBVersion.fromString("1710.-1")); + List resolvedMigrations = testInstance.resolveMigrations(); + assertTrue(resolvedMigrations.isEmpty()); + } + + private Migration createMigration(String version) { + return new Migration() { + @Override + public String description() { + return null; + } + + @Override + public DBVersion getVersion() { + return DBVersion.fromString(version); + } + + @Override + public MigrationResult migrate() { + return null; + } + }; + } + + private SpringBeansMigrationResolver createTestSubject() { + return new SpringBeansMigrationResolver(null, null, new SdcRepoService(new MigrationTasksDao(mock(CassandraClient.class)))); + } } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/service/SdcRepoServiceTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/service/SdcRepoServiceTest.java index ddcbb8bdc2..e260464669 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/service/SdcRepoServiceTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/service/SdcRepoServiceTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,23 +20,23 @@ package org.openecomp.sdc.asdctool.migration.service; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.testng.Assert.assertEquals; + +import java.math.BigInteger; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.MockitoAnnotations; import org.mockito.internal.verification.Times; +import org.mockito.junit.jupiter.MockitoExtension; import org.openecomp.sdc.asdctool.migration.core.DBVersion; import org.openecomp.sdc.asdctool.migration.dao.MigrationTasksDao; import org.openecomp.sdc.be.resources.data.MigrationTaskEntry; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; -import java.math.BigInteger; - -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.testng.Assert.assertEquals; - -public class SdcRepoServiceTest { +@ExtendWith(MockitoExtension.class) +class SdcRepoServiceTest { @InjectMocks private SdcRepoService testInstance; @@ -44,13 +44,8 @@ public class SdcRepoServiceTest { @Mock private MigrationTasksDao migrationTasksDaoMock; - @BeforeMethod - public void setUp() { - MockitoAnnotations.initMocks(this); - } - @Test - public void testGetLatestVersion_noMinorVersionForCurrentVersion() { + void testGetLatestVersion_noMinorVersionForCurrentVersion() { when(migrationTasksDaoMock.getLatestMajorVersion()).thenReturn(DBVersion.DEFAULT_VERSION.getMajor()); when(migrationTasksDaoMock.getLatestMinorVersion(migrationTasksDaoMock.getLatestMajorVersion())).thenReturn(BigInteger.valueOf(0)); DBVersion latestDBVersion = testInstance.getLatestDBVersion(); @@ -59,8 +54,8 @@ public class SdcRepoServiceTest { } @Test - public void testCreateMigrationTask() { - MigrationTaskEntry taskEntry = new MigrationTaskEntry(); + void testCreateMigrationTask() { + MigrationTaskEntry taskEntry = new MigrationTaskEntry(); testInstance.createMigrationTask(taskEntry); verify(migrationTasksDaoMock, new Times(1)).createMigrationTask(taskEntry); } diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java index 071a30fea2..5a1f0bf0dc 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/migration/tasks/mig1806/ForwardPathMigrationTest.java @@ -7,9 +7,9 @@ * 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. @@ -20,53 +20,58 @@ package org.openecomp.sdc.asdctool.migration.tasks.mig1806; +import static org.junit.Assert.assertThat; + +import java.math.BigInteger; import org.hamcrest.core.Is; import org.hamcrest.core.IsNull; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; import org.openecomp.sdc.asdctool.migration.core.DBVersion; import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.impl.UserAdminOperation; -import java.math.BigInteger; - -import static org.junit.Assert.assertThat; - -public class ForwardPathMigrationTest { +@ExtendWith(MockitoExtension.class) +class ForwardPathMigrationTest { - ForwardPathMigration forwardPathMigration = null; + private ForwardPathMigration forwardPathMigration = null; @Mock - JanusGraphDao janusGraphDao; + private JanusGraphDao janusGraphDao; @Mock - UserAdminOperation userAdminOperation; + private UserAdminOperation userAdminOperation; @Mock - ToscaOperationFacade toscaOperationFacade; + private ToscaOperationFacade toscaOperationFacade; - @Before + @BeforeEach public void setUp() throws Exception { forwardPathMigration = new ForwardPathMigration(janusGraphDao, userAdminOperation, toscaOperationFacade); } @Test - public void testDescription() { - assertThat(forwardPathMigration,IsNull.notNullValue()); + void testDescription() { + assertThat(forwardPathMigration, IsNull.notNullValue()); assertThat("remove corrupted forwarding paths ", Is.is(forwardPathMigration.description())); } @Test - public void testGetVersion() { + void testGetVersion() { DBVersion dbVersion = DBVersion.from(BigInteger.valueOf(Version.MAJOR.getValue()), BigInteger.valueOf(Version.MINOR.getValue())); - assertThat(dbVersion,Is.is(forwardPathMigration.getVersion())); + assertThat(dbVersion, Is.is(forwardPathMigration.getVersion())); } - @Test(expected = NullPointerException.class) - public void testMigrate() { - assertThat(forwardPathMigration,IsNull.notNullValue()); - forwardPathMigration.migrate(); + @Test + void testMigrate() { + assertThat(forwardPathMigration, IsNull.notNullValue()); + Assertions.assertThrows(NullPointerException.class, () -> { + forwardPathMigration.migrate(); + }); } } -- cgit 1.2.3-korg