-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created StockFileReaderTest
- Loading branch information
Nikollai
committed
Apr 12, 2026
1 parent
3acdb6a
commit 49ac7b1
Showing
2 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| package millions; | ||
|
|
||
| import millions.controller.fileIO.StockFileReader; | ||
| import org.junit.jupiter.api.BeforeAll; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.io.TempDir; | ||
|
|
||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
|
||
| public class StockFileReaderTest { | ||
| @TempDir | ||
| static Path tempDir; | ||
|
|
||
| static Path sharedFile; | ||
| @BeforeAll | ||
| public static void setUpTestFile() throws Exception { | ||
| sharedFile = Files.createFile(tempDir.resolve("file.csv")); | ||
| String string = "# Top 500 US Stocks by Market Cap\n"; | ||
| string += "# Ticker,Name,Price\n"; | ||
| string += "\n"; | ||
| string += "NVDA,Nvidia,191.27\n"; | ||
| string += "AAPL,Apple Inc.,276.43\n"; | ||
| string += "MSFT,Microsoft,404.68\n"; | ||
| Files.writeString(sharedFile, string); | ||
| } | ||
|
|
||
| @Test | ||
| public void testReadStockFile() throws Exception { | ||
| StockFileReader stockFileReader = new StockFileReader(sharedFile); | ||
| assertEquals(6, stockFileReader.readFile().size()); | ||
| } | ||
| } |