Skip to content

Commit

Permalink
handle sonnar
Browse files Browse the repository at this point in the history
  • Loading branch information
ntqdinh-axonivy committed Sep 6, 2024
1 parent 93dc8b8 commit ecd4814
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
import com.axonivy.market.repository.CustomProductRepository;
import com.axonivy.market.repository.ProductModuleContentRepository;
import lombok.Builder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.FindAndModifyOptions;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.aggregation.*;
import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationOperation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,12 @@ void testIncreaseInstallationCount_NullProduct() {
int updatedCount = repo.increaseInstallationCount(ID);
assertEquals(0, updatedCount);
}

@Test
void testUpdateInitialCount() {
setUpMockAggregateResult();
int initialCount = 10;
repo.updateInitialCount(ID, initialCount);
verify(mongoTemplate).updateFirst(any(Query.class), eq(new Update().inc("InstallationCount", initialCount).set("SynchronizedInstallationCount", true)), eq(Product.class));
}
}

0 comments on commit ecd4814

Please sign in to comment.