-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Description
- Detailed Description:
The utility methods inPortfolioInfohave 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:
- Create a Test Class:
Create a new JUnit test class (e.g.,PortfolioInfoTest) in the test folder. - 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); }
- Test Various Scenarios:
Include tests for normal data, edge cases, and possible erroneous inputs. - Run the Tests:
Execute the test suite and ensure all tests pass.
- Create a Test Class: