Skip to content

Commit

Permalink
MARP-572: Fix warning codes
Browse files Browse the repository at this point in the history
  • Loading branch information
nntthuy-axonivy committed Jul 26, 2024
1 parent 4a3f4e2 commit f82ccd2
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class ProductJsonConstants {
public static final String TYPE = "type";
public static final String DEPENDENCIES = "dependencies";
public static final String INSTALLERS = "installers";
public static final String DEPENDENCY_SUFFIX = "-dependency";
public static final String MAVEN_IMPORT_INSTALLER_ID = "maven-import";
public static final String MAVEN_DROPIN_INSTALLER_ID = "maven-dropins";
public static final String MAVEN_DEPENDENCY_INSTALLER_ID = "maven-dependency";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public ProductModuleContent getReadmeAndProductContentsFromTag(Product product,
}
}
} catch (Exception e) {
log.error("Cannot get product.json and README file's content {}", e);
log.error("Cannot get product.json and README file's content {}", e.getMessage());
return null;
}
return productModuleContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
public class GitHubUtils {

private static String pathToProductFolderFromTagContent;
private static String pathToImageFolder;

public static long getGHCommitDate(GHCommit commit) {
long commitTime = 0L;
Expand Down Expand Up @@ -111,6 +110,7 @@ public static String getNonStandardProductFilePath(String productId) {
}

public static String getNonStandardImageFolder(String productId) {
String pathToImageFolder;
switch (productId) {
case NonStandardProductPackageConstants.EXCEL_IMPORTER:
pathToImageFolder = "doc";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public interface ProductRepository extends MongoRepository<Product, String> {

Product findByLogoUrl(String logoUrl);

Product findByIdAndType(String id, String type);

Optional<Product> findById(String productId);

@Query("{'marketDirectory': {$regex : ?0, $options: 'i'}}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void testFindProductVersionsById() {
Mockito.when(
versionService.getArtifactsAndVersionToDisplay(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString()))
.thenReturn(models);
ResponseEntity<List<MavenArtifactVersionModel>> result = productDetailsController.findProductVersionsById("protal",
ResponseEntity<List<MavenArtifactVersionModel>> result = productDetailsController.findProductVersionsById("portal",
true, "10.0.1");
Assertions.assertEquals(HttpStatus.OK, result.getStatusCode());
Assertions.assertEquals(1, Objects.requireNonNull(result.getBody()).size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void setup() throws IOException {
}

@AfterEach
void after() throws IOException {
void after() {
reset(mockGHOrganization);
reset(gitHubService);
}
Expand Down Expand Up @@ -230,7 +230,7 @@ void testGetReadmeAndProductContentFromTag_ImageFromFolder() throws IOException
when(mockImageFile.isDirectory()).thenReturn(true);
when(mockImageFile.getDownloadUrl()).thenReturn(IMAGE_DOWNLOAD_URL);

PagedIterable<GHContent> pagedIterable = mock(PagedIterable.class);
PagedIterable<GHContent> pagedIterable = Mockito.mock(String.valueOf(GHContent.class));
when(mockImageFile.listDirectoryContent()).thenReturn(pagedIterable);
when(pagedIterable.toList()).thenReturn(List.of(mockImageFile));

Expand Down Expand Up @@ -340,7 +340,7 @@ private static InputStream getMockInputStreamWithOutProjectAndDependency() {
return new ByteArrayInputStream(jsonContent.getBytes(StandardCharsets.UTF_8));
}

private Product createMockProduct() throws IOException {
private Product createMockProduct() {
Product product = new Product();
product.setId("docuware-connector");
product.setLanguage("en");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void testSyncProductsFirstTime() throws IOException {
when(ghAxonIvyProductRepoService.getReadmeAndProductContentsFromTag(any(), any(), anyString())).thenReturn(
mockReadmeProductContent());
when(gitHubService.getRepository(any())).thenReturn(ghRepository);
PagedIterable<GHTag> pagedIterable = mock(PagedIterable.class);
PagedIterable<GHTag> pagedIterable = Mockito.mock(String.valueOf(GHTag.class));
when(ghRepository.listTags()).thenReturn(pagedIterable);

GHTag mockTag = mock(GHTag.class);
Expand Down Expand Up @@ -341,7 +341,7 @@ void testFetchProductDetail() {
String id = "amazon-comprehend";
Product mockProduct = mockResultReturn.getContent().get(0);
mockProduct.setSynchronizedInstallationCount(true);
when(productRepository.findById(id)).thenReturn(Optional.ofNullable(mockProduct));
when(productRepository.findById(id)).thenReturn(Optional.of(mockProduct));
Product result = productService.fetchProductDetail(id);
assertEquals(mockProduct, result);
verify(productRepository, times(1)).findById(id);
Expand Down

0 comments on commit f82ccd2

Please sign in to comment.