Fix new line after @Test (#2486)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-06-20 17:42:55 +03:00
committed by GitHub
parent cb7f1107fe
commit ef25aa59f0
152 changed files with 2948 additions and 1474 deletions

View File

@@ -22,7 +22,8 @@ class Base62UtilTest {
/**
* Convert Base10 numbers to Base62 ASCII strings.
*/
@Test void fromBase10() {
@Test
void fromBase10() {
assertThat(Base62Util.fromBase10(0L)).isEqualTo("0");
assertThat(Base62Util.fromBase10(11L)).isEqualTo("B");
assertThat(Base62Util.fromBase10(36L)).isEqualTo("a");
@@ -32,7 +33,8 @@ class Base62UtilTest {
/**
* Convert Base62 ASCII strings to Base10 numbers.
*/
@Test void toBase10() {
@Test
void toBase10() {
assertThat(Base62Util.toBase10("0")).isZero();
assertThat(Base62Util.toBase10("B")).isEqualTo(11);
assertThat(Base62Util.toBase10("a")).isEqualTo(36L);

View File

@@ -62,7 +62,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Tests the generation of http download url.
*/
@Test void urlGenerationWithDefaultConfiguration() {
@Test
void urlGenerationWithDefaultConfiguration() {
properties.getProtocols().put("download-http", new UrlProtocol());
final List<ArtifactUrl> ddiUrls = urlHandlerUnderTest.getUrls(placeHolder, ApiType.DDI);
@@ -77,7 +78,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Tests the generation of custom download url with a CoAP example that supports DMF only.
*/
@Test void urlGenerationWithCustomConfiguration() {
@Test
void urlGenerationWithCustomConfiguration() {
final UrlProtocol proto = new UrlProtocol();
proto.setIp("127.0.0.1");
proto.setPort(5683);
@@ -97,7 +99,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Tests the generation of custom download url using Base62 references with a CoAP example that supports DMF only.
*/
@Test void urlGenerationWithCustomShortConfiguration() {
@Test
void urlGenerationWithCustomShortConfiguration() {
final UrlProtocol proto = new UrlProtocol();
proto.setIp("127.0.0.1");
proto.setPort(5683);
@@ -117,7 +120,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Verifies that the full qualified host of the statically defined hostname is replaced with the host of the request.
*/
@Test void urlGenerationWithHostFromRequest() throws URISyntaxException {
@Test
void urlGenerationWithHostFromRequest() throws URISyntaxException {
final String testHost = "ddi.host.com";
final UrlProtocol proto = new UrlProtocol();
@@ -138,7 +142,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Verifies that the protocol of the statically defined hostname is replaced with the protocol of the request.
*/
@Test void urlGenerationWithProtocolFromRequest() throws URISyntaxException {
@Test
void urlGenerationWithProtocolFromRequest() throws URISyntaxException {
final String testHost = "ddi.host.com";
final UrlProtocol proto = new UrlProtocol();
@@ -154,7 +159,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Verifies that the port of the statically defined hostname is replaced with the port of the request.
*/
@Test void urlGenerationWithPortFromRequest() throws URISyntaxException {
@Test
void urlGenerationWithPortFromRequest() throws URISyntaxException {
final UrlProtocol proto = new UrlProtocol();
proto.setRef("{protocol}://{hostname}:{portRequest}/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{artifactFileName}");
@@ -176,7 +182,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Verifies that if default protocol port in request is used then url is returned without port
*/
@Test void urlGenerationWithPortFromRequestForHttps() throws URISyntaxException {
@Test
void urlGenerationWithPortFromRequestForHttps() throws URISyntaxException {
final String protocol = "https";
final UrlProtocol proto = new UrlProtocol();
proto.setRef("{protocolRequest}://{hostnameRequest}:{portRequest}/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{artifactFileName}");
@@ -195,7 +202,8 @@ class PropertyBasedArtifactUrlHandlerTest {
/**
* Verifies that the domain of the statically defined hostname is replaced with the domain of the request.
*/
@Test void urlGenerationWithDomainFromRequest() throws URISyntaxException {
@Test
void urlGenerationWithDomainFromRequest() throws URISyntaxException {
final UrlProtocol proto = new UrlProtocol();
proto.setHostname("host.bumlux.net");
proto.setRef("{protocol}://{domainRequest}/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{artifactFileName}");

View File

@@ -30,7 +30,8 @@ class URLPlaceholderTest {
/**
* Same object should be equal
*/
@Test // Exception squid:S5785 - JUnit assertTrue/assertFalse should be simplified to the corresponding dedicated assertion
@Test
// Exception squid:S5785 - JUnit assertTrue/assertFalse should be simplified to the corresponding dedicated assertion
// Need to test the equals method and need to bypass magic logic in utility classes
@SuppressWarnings({ "squid:S5838" })
void sameObjectShouldBeEqual() {
@@ -41,7 +42,8 @@ class URLPlaceholderTest {
/**
* Different object should not be equal
*/
@Test @SuppressWarnings({ "squid:S5838" })
@Test
@SuppressWarnings({ "squid:S5838" })
void differentObjectShouldNotBeEqual() {
final URLPlaceholder.SoftwareData softwareData2 = new URLPlaceholder.SoftwareData(2L, "file.txt", 123L, "someHash123");
final URLPlaceholder placeholder2 = new URLPlaceholder("SuperCorp", 123L, "Super-2", 2L, softwareData2);
@@ -57,7 +59,8 @@ class URLPlaceholderTest {
/**
* Different objects with same properties should be equal
*/
@Test void differentObjectsWithSamePropertiesShouldBeEqual() {
@Test
void differentObjectsWithSamePropertiesShouldBeEqual() {
final URLPlaceholder placeholderWithSameProperties = new URLPlaceholder(placeholder.getTenant(), placeholder.getTenantId(),
placeholder.getControllerId(), placeholder.getTargetId(), softwareData);
assertThat(placeholder).isEqualTo(placeholderWithSameProperties);
@@ -67,7 +70,8 @@ class URLPlaceholderTest {
/**
* Should not equal null
*/
@Test // Exception squid:S5785 - JUnit assertTrue/assertFalse should be simplified to
@Test
// Exception squid:S5785 - JUnit assertTrue/assertFalse should be simplified to
// the corresponding dedicated assertion
// Need to test the equals method and need to bypass magic logic in utility
// classes
@@ -80,7 +84,8 @@ class URLPlaceholderTest {
/**
* HashCode should not change
*/
@Test void hashCodeShouldNotChange() {
@Test
void hashCodeShouldNotChange() {
final URLPlaceholder placeholderWithSameProperties = new URLPlaceholder(placeholder.getTenant(), placeholder.getTenantId(),
placeholder.getControllerId(), placeholder.getTargetId(), softwareData);
assertThat(placeholder).hasSameHashCodeAs(placeholder).hasSameHashCodeAs(placeholderWithSameProperties);

View File

@@ -59,7 +59,8 @@ class ArtifactFilesystemRepositoryTest {
/**
* Verifies that an artifact can be successfully stored in the file-system repository
*/
@Test void storeSuccessfully() throws IOException {
@Test
void storeSuccessfully() throws IOException {
final byte[] fileContent = randomBytes();
final AbstractDbArtifact artifact = storeRandomArtifact(fileContent);
@@ -71,7 +72,8 @@ class ArtifactFilesystemRepositoryTest {
/**
* Verifies that an artifact can be successfully stored in the file-system repository
*/
@Test void getStoredArtifactBasedOnSHA1Hash() throws IOException {
@Test
void getStoredArtifactBasedOnSHA1Hash() throws IOException {
final byte[] fileContent = randomBytes();
final AbstractDbArtifact artifact = storeRandomArtifact(fileContent);
@@ -81,7 +83,8 @@ class ArtifactFilesystemRepositoryTest {
/**
* Verifies that an artifact can be deleted in the file-system repository
*/
@Test void deleteStoredArtifactBySHA1Hash() throws IOException {
@Test
void deleteStoredArtifactBySHA1Hash() throws IOException {
final AbstractDbArtifact artifact = storeRandomArtifact(randomBytes());
artifactFilesystemRepository.deleteBySha1(TENANT, artifact.getHashes().getSha1());
@@ -91,7 +94,8 @@ class ArtifactFilesystemRepositoryTest {
/**
* Verifies that all artifacts of a tenant can be deleted in the file-system repository
*/
@Test void deleteStoredArtifactOfTenant() throws IOException {
@Test
void deleteStoredArtifactOfTenant() throws IOException {
final AbstractDbArtifact artifact = storeRandomArtifact(randomBytes());
artifactFilesystemRepository.deleteByTenant(TENANT);
@@ -101,7 +105,8 @@ class ArtifactFilesystemRepositoryTest {
/**
* Verifies that an artifact which does not exists is deleted quietly in the file-system repository
*/
@Test void deleteArtifactWhichDoesNotExistsBySHA1HashWithoutException() throws IOException {
@Test
void deleteArtifactWhichDoesNotExistsBySHA1HashWithoutException() throws IOException {
try {
artifactFilesystemRepository.deleteBySha1(TENANT, "sha1HashWhichDoesNotExists");
} catch (final Exception e) {

View File

@@ -29,7 +29,8 @@ class ArtifactFilesystemTest {
/**
* Verifies that an exception is thrown on opening an InputStream when file does not exists
*/
@Test void getInputStreamOfNonExistingFileThrowsException() {
@Test
void getInputStreamOfNonExistingFileThrowsException() {
final File file = new File("fileWhichTotalDoesNotExists");
final ArtifactFilesystem underTest = new ArtifactFilesystem(
file, "fileWhichTotalDoesNotExists",
@@ -42,7 +43,8 @@ class ArtifactFilesystemTest {
/**
* Verifies that an InputStream can be opened if file exists
*/
@Test void getInputStreamOfExistingFile() throws IOException {
@Test
void getInputStreamOfExistingFile() throws IOException {
final ArtifactFilesystem underTest = new ArtifactFilesystem(
AbstractArtifactRepository.createTempFile(false), ArtifactFilesystemTest.class.getSimpleName(),
new DbArtifactHash("1", "2", "3"), 0L, null);