Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
lepdou committed Sep 11, 2021
1 parent 3bc58a5 commit 16acb77
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import java.util.zip.ZipInputStream;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -162,6 +163,7 @@ public void testNamespaceExportImport() throws FileNotFoundException {
when(namespaceService.createNamespace(any(), any())).thenReturn(genNamespaceDTO(1));

when(itemService.findItems(any(), any(), any(), any())).thenReturn(Lists.newArrayList());
when(itemService.loadItem(any(), any(), any(), any(), anyString())).thenThrow(new RuntimeException());

FileInputStream fileInputStream = new FileInputStream("/tmp/apollo.zip");
ZipInputStream zipInputStream = new ZipInputStream(fileInputStream);
Expand All @@ -180,7 +182,7 @@ public void testNamespaceExportImport() throws FileNotFoundException {
verify(clusterService, times(4)).createCluster(any(), any());

verify(namespaceService, times(6)).createNamespace(any(), any());
verify(itemService, times(6)).updateConfigItemByText(any());
verify(itemService, times(12)).createItem(any(), any(), any(), any(), any());
}

private App genApp(String name, String appId, String orgId, String orgName) {
Expand Down

0 comments on commit 16acb77

Please sign in to comment.