Skip to content

Commit

Permalink
JUnit5 support (#67)
Browse files Browse the repository at this point in the history
* First preparation for JUnit5

Signed-off-by: Dominic Schabel <dominic.schabel@bosch.io>

* Migrated all tests to JUnit5

Signed-off-by: Dominic Schabel <dominic.schabel@bosch.io>
  • Loading branch information
schabdo committed Feb 16, 2021
1 parent afc0c84 commit b02f66f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion hawkbit-extension-artifact-repository-gcs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit4</artifactId>
<artifactId>allure-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@

import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact;
import org.eclipse.hawkbit.artifact.repository.model.DbArtifactHash;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
Expand All @@ -47,11 +47,12 @@
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.mockito.junit.jupiter.MockitoExtension;

/**
* Test class for the {@link GcsRepository}.
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
@Feature("Unit Tests - GCS Repository")
@Story("GCS Artifact Repository")
public class GcsRepositoryTest {
Expand All @@ -70,7 +71,7 @@ public class GcsRepositoryTest {
private ArgumentCaptor<BlobInfo> blobCaptor;
private GcsRepository gcsRepositoryUnderTest;

@Before
@BeforeEach
public void before() {
gcsStorageMock = mock(Storage.class);
gcsRepositoryUnderTest = new GcsRepository(gcsStorageMock, gcpProperties);
Expand Down
2 changes: 1 addition & 1 deletion hawkbit-extension-artifact-repository-mongo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit4</artifactId>
<artifactId>allure-junit5</artifactId>
<scope>test</scope>
</dependency>
<!-- MongoDB -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@
import java.security.NoSuchAlgorithmException;
import java.util.Random;

import io.qameta.allure.Description;
import org.eclipse.hawkbit.artifact.TestConfiguration;
import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact;
import org.eclipse.hawkbit.artifact.repository.model.DbArtifactHash;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Description;
import org.springframework.test.context.junit4.SpringRunner;

import com.google.common.io.BaseEncoding;

Expand All @@ -36,7 +34,6 @@

@Feature("Component Tests - Repository")
@Story("Artifact Store MongoDB")
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {MongoDBArtifactStoreAutoConfiguration.class, TestConfiguration.class}, properties = {
"spring.mongodb.embedded.version=3.5.5",
"spring.mongodb.embedded.features=sync_delay,no_http_interface_arg"})
Expand Down
2 changes: 1 addition & 1 deletion hawkbit-extension-artifact-repository-s3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit4</artifactId>
<artifactId>allure-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@

import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact;
import org.eclipse.hawkbit.artifact.repository.model.DbArtifactHash;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;

import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.ObjectMetadata;
Expand All @@ -49,13 +48,15 @@
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;
import org.mockito.junit.jupiter.MockitoExtension;

/**
* Test class for the {@link S3Repository}.
*/
@RunWith(MockitoJUnitRunner.class)

@Feature("Unit Tests - S3 Repository")
@Story("S3 Artifact Repository")
@ExtendWith(MockitoExtension.class)
public class S3RepositoryTest {

private static final String TENANT = "test_tenant";
Expand All @@ -81,7 +82,7 @@ public class S3RepositoryTest {
private final S3RepositoryProperties s3Properties = new S3RepositoryProperties();
private S3Repository s3RepositoryUnderTest;

@Before
@BeforeEach
public void before() {
amazonS3Mock = mock(AmazonS3.class);
s3RepositoryUnderTest = new S3Repository(amazonS3Mock, s3Properties);
Expand Down

0 comments on commit b02f66f

Please sign in to comment.