-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Issue** [APIM-8360](https://gravitee.atlassian.net/browse/APIM-8360) ## Description I made the minimal change because this code is fully reworked for 4.7
- Loading branch information
1 parent
b7fe402
commit c447a6f
Showing
4 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...c/test/java/io/gravitee/apim/infra/domain_service/api/ApiExportDomainServiceImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.gravitee.apim.infra.domain_service.api; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.Mockito.when; | ||
|
||
import io.gravitee.apim.core.api.model.import_definition.GraviteeDefinition; | ||
import io.gravitee.apim.core.audit.model.AuditInfo; | ||
import io.gravitee.definition.model.v4.ApiType; | ||
import io.gravitee.rest.api.model.v4.api.ApiEntity; | ||
import io.gravitee.rest.api.model.v4.api.ExportApiEntity; | ||
import io.gravitee.rest.api.service.v4.ApiImportExportService; | ||
import java.util.UUID; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class ApiExportDomainServiceImplTest { | ||
|
||
@Mock | ||
ApiImportExportService exportService; | ||
|
||
@InjectMocks | ||
ApiExportDomainServiceImpl sut; | ||
|
||
@Test | ||
void exportServiceMustMapTypeWhenExportV4() { | ||
// Given | ||
String apiId = UUID.randomUUID().toString(); | ||
ApiEntity api = new ApiEntity(); | ||
api.setType(ApiType.PROXY); | ||
when(exportService.exportApi(any(), any(), any(), any())).thenReturn(new ExportApiEntity(api, null, null, null, null, null)); | ||
|
||
// When | ||
GraviteeDefinition export = sut.export(apiId, AuditInfo.builder().build()); | ||
|
||
// Then | ||
assertThat(export.getApi().getType()).isEqualTo(ApiType.PROXY); | ||
} | ||
} |