iiitl / iiitl/Stoxs

[test]: Unit Tests for PortfolioInfo Methods

Open
#5 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

easy test
Dominant language
TypeScript
Stars
1
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Description

  • Detailed Description:
    The utility methods in PortfolioInfo have no tests, leaving potential edge cases (such as an empty list or null values) unchecked. Unit tests are crucial to ensure the methods work as intended.
  • How to Solve:
    1. Create a Test Class:
      Create a new JUnit test class (e.g., PortfolioInfoTest) in the test folder.
    2. Write Test Cases:
      Write tests for each method. For instance:
      @Test
      public void testCalculateTotalPortfolioValue_emptyList() {
          List<Stock> stocks = new ArrayList<>();
          double value = PortfolioInfo.calculateTotalPortfolioValue(stocks);
          assertEquals(0.0, value, 0.01);
      }
      
    3. Test Various Scenarios:
      Include tests for normal data, edge cases, and possible erroneous inputs.
    4. Run the Tests:
      Execute the test suite and ensure all tests pass.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the PortfolioInfo utility and inspect each method and its inputs before creating the requested PortfolioInfoTest JUnit class. Cover normal data, empty lists, null values, and other erroneous inputs mentioned in the issue, then run the project test suite and confirm all tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.