From b8bdeadb28804c271c9f3c97192d1b4b9eca991e Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 14:31:50 +0100 Subject: [PATCH 01/50] feat: Add Stock class. Simple constructor with getters/setters. Basic JavaDoc. --- .../java/edu/ntnu/idi/idatt/marked/Stock.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/main/java/edu/ntnu/idi/idatt/marked/Stock.java diff --git a/src/main/java/edu/ntnu/idi/idatt/marked/Stock.java b/src/main/java/edu/ntnu/idi/idatt/marked/Stock.java new file mode 100644 index 0000000..11ca9f8 --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/marked/Stock.java @@ -0,0 +1,68 @@ +package edu.ntnu.idi.idatt.marked; + + +import java.math.BigDecimal; +import java.util.List; + +/** + * Stock class + * + *

Class that describes an object of a unique stock.

+ * + */ +public class Stock { + + private final String symbol; + private final String company; + private final List prices; + + /** + * Constructor for a Stock. + * + * @param symbol - String that indicates the symbol of a stock, ex. "APPL" as a short form of company. + * @param company - String, company name, ex. "Apple Inc." + * @param prices - An array of BigInteger that indicates the price corresponding with time. + */ + public Stock(String symbol, String company, List prices) { + this.symbol = symbol; + this.company = company; + this.prices = prices; + } + + /** + * Getters + * + * @return - Their corresponding variables. + */ + + public String getSymbol() { + return symbol; + } + + public String getCompany() { + return company; + } + + public List getPrices() { + return prices; + } + + /** + * Getter for sale price + * + * @return - BigDecimal with current (newest in array) stock price. + */ + public BigDecimal getSalesPrice() { + return prices.getLast(); + } + + /** + * Method that adds new price to the price array. + * + * @param price - BigDecimal, new price. + */ + public void addNewSalesPrice(BigDecimal price) { + prices.add(price); + } + +} From 21d7a837c9bfba8b17853b3970c2392708bbe2fd Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 14:31:58 +0100 Subject: [PATCH 02/50] feat: Add Share class. Simple constructor with getters/setters. Basic JavaDoc. --- .../java/edu/ntnu/idi/idatt/marked/Share.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/main/java/edu/ntnu/idi/idatt/marked/Share.java diff --git a/src/main/java/edu/ntnu/idi/idatt/marked/Share.java b/src/main/java/edu/ntnu/idi/idatt/marked/Share.java new file mode 100644 index 0000000..bea434d --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/marked/Share.java @@ -0,0 +1,49 @@ +package edu.ntnu.idi.idatt.marked; + +import java.math.BigDecimal; + +/** + * Share class + * + *

Class that describes the ownership of a specific stock.

+ * + */ +public class Share { + + private final Stock stock; + private BigDecimal quantity; + private BigDecimal purchasePrice; + + /** + * Constructor for a Share. + * + * @param stock - The stock this share corresponds to. + * @see Stock + * @param quantity - The total number of shares of a stock. Measaured in percentage (Shares/Volume) + * @param purchasePrice - The current price when the stock was bought. + */ + public Share(Stock stock, BigDecimal quantity, BigDecimal purchasePrice) { + this.stock = stock; + this.quantity = quantity; + this.purchasePrice = purchasePrice; + } + + /** + * Getters + * + * @return - Their corresponding variables. + */ + + public Stock getStock() { + return stock; + } + + public BigDecimal getQuantity() { + return quantity; + } + + public BigDecimal getPurchasePrice() { + return purchasePrice; + } + +} From f8cbbd6c97840abcf75f4f6edf8058c2ef52e2f5 Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 14:45:33 +0100 Subject: [PATCH 03/50] feat: Add Portfolio class. Implemented simple methods for share management. --- .../edu/ntnu/idi/idatt/marked/Portfolio.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java diff --git a/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java b/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java new file mode 100644 index 0000000..535259b --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java @@ -0,0 +1,65 @@ +package edu.ntnu.idi.idatt.marked; + +import java.util.ArrayList; +import java.util.List; + +/** + * Portfolio class + * + *

Class that functions as a wallet for a player + * storing all results of transactions made.

+ * + */ +public class Portfolio { + + private ArrayList shares; + + /** + * Setter for ArrayList shares. + * + * @param share - The bought share + * @return - was the list modified? + */ + public boolean addShare(Share share){ + return shares.add(share); + } + + /** + * Setter for ArrayList shares. + * + * @param share - The sold share + * @return - was the list modified? + */ + public boolean removeShare(Share share){ + return shares.add(share); + } + + /** + * Getter for ArrayList shares. + * + * @return - List of all shares owned. + */ + public List getShares() { + return shares; + } + + /** + * Getter for ArrayList shares. + * + * @param symbol - The symbol of the stock corresponding to the share. + * @return - List of shares owned that corresponds with a company symbol. + */ + public List getShares(String symbol) { + return shares.stream().filter(s -> s.getStock().getSymbol().equals(symbol)).toList(); + } + + /** + * Method for checking if the portfolio contains a specific share + * + * @return - If the share was found. + */ + public boolean contains(Share share) { + return shares.contains(share); + } + +} From dbd2425ca660bbcc9afe5303057a297642798f06 Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 14:55:28 +0100 Subject: [PATCH 04/50] chore(Share.class): Modify JavaDoc description mistake. --- src/main/java/edu/ntnu/idi/idatt/marked/Share.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/marked/Share.java b/src/main/java/edu/ntnu/idi/idatt/marked/Share.java index bea434d..1f9c14b 100644 --- a/src/main/java/edu/ntnu/idi/idatt/marked/Share.java +++ b/src/main/java/edu/ntnu/idi/idatt/marked/Share.java @@ -19,7 +19,7 @@ public class Share { * * @param stock - The stock this share corresponds to. * @see Stock - * @param quantity - The total number of shares of a stock. Measaured in percentage (Shares/Volume) + * @param quantity - The total of bought shares of the stock. * @param purchasePrice - The current price when the stock was bought. */ public Share(Stock stock, BigDecimal quantity, BigDecimal purchasePrice) { From 5f9a3e8cb53fb7896dfdee4bc3fb25a538e137bc Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 15:07:34 +0100 Subject: [PATCH 05/50] feat: Create TransactionCalculator interface --- .../transaction/TransactionCalculator.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/edu/ntnu/idi/idatt/transaction/TransactionCalculator.java diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionCalculator.java b/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionCalculator.java new file mode 100644 index 0000000..1818aa8 --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionCalculator.java @@ -0,0 +1,21 @@ +package edu.ntnu.idi.idatt.transaction; + +import java.math.BigDecimal; + +/** + * TransactionCalculator interface + * + *

Contains methods that are used upon doing a transaction + * corresponding to a share and a week.

+ * @see PurchaseCalculator + * @see SaleCalculator + * + */ +public interface TransactionCalculator { + + BigDecimal calculateGross(); // Gross - Norsk: verdi før avgifter + BigDecimal calculateCommision(); // Commision - Norsk: (Kurtasje) En avgift som betales til megleren. + BigDecimal calculateTax(); // Tax - Norsk: Skatt, en avgift som betales til staten. + BigDecimal calculateTotal(); // Totalverdi etter avgifter + +} From b0621ae8f8b5f584a37480fdba287e9dd26d58f5 Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 15:18:56 +0100 Subject: [PATCH 06/50] feat: Implemented PurchaseCalculator and SaleCalculator with project requirements. --- .../idatt/transaction/PurchaseCalculator.java | 70 +++++++++++++++++ .../idi/idatt/transaction/SaleCalculator.java | 76 +++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 src/main/java/edu/ntnu/idi/idatt/transaction/PurchaseCalculator.java create mode 100644 src/main/java/edu/ntnu/idi/idatt/transaction/SaleCalculator.java diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/PurchaseCalculator.java b/src/main/java/edu/ntnu/idi/idatt/transaction/PurchaseCalculator.java new file mode 100644 index 0000000..cc9bd22 --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/PurchaseCalculator.java @@ -0,0 +1,70 @@ +package edu.ntnu.idi.idatt.transaction; + +import edu.ntnu.idi.idatt.marked.Share; + +import java.math.BigDecimal; + +/** + * PurchaseCalculator class + * + *

Calculates transaction price based on + * share bought.

+ * + */ +public class PurchaseCalculator implements TransactionCalculator{ + + private final BigDecimal purchasePrice; + private final BigDecimal quantity; + + /** + * Constructor for PurchaseCalculator + * + * @param share - The bought share + */ + public PurchaseCalculator(Share share){ + this.purchasePrice = share.getPurchasePrice(); + this.quantity = share.getQuantity(); + } + + /** + * Method that calculates gross value + * + * @return - BigDecimal of purchase price x share quantity + */ + @Override + public BigDecimal calculateGross() { + return purchasePrice.multiply(quantity); + } + + /** + * Method that calculates the commission fee + * + * @return - BigDecimal of gross value x 0.5%. + */ + @Override + public BigDecimal calculateCommision() { + BigDecimal fee = BigDecimal.valueOf(0.005); // Corresponding to 0.5% + return calculateGross().multiply(fee); + } + + /** + * Method that calculates the tax + * + * @return - BigDecimal of 0 based on project requirements. + */ + @Override + public BigDecimal calculateTax() { + return BigDecimal.ZERO; + } + + /** + * Method that calculates the total price of a bought share + * + * @return - BigDecimal of gross value + commision fee + tax + */ + @Override + public BigDecimal calculateTotal() { + return calculateGross().add(calculateCommision()).add(calculateTax()); + } + +} diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/SaleCalculator.java b/src/main/java/edu/ntnu/idi/idatt/transaction/SaleCalculator.java new file mode 100644 index 0000000..3c83ce3 --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/SaleCalculator.java @@ -0,0 +1,76 @@ +package edu.ntnu.idi.idatt.transaction; + +import edu.ntnu.idi.idatt.marked.Share; + +import java.math.BigDecimal; + + +/** + * SaleCalculator class + * + *

Calculates transaction profit based on + * share sold.

+ * + */ +public class SaleCalculator implements TransactionCalculator{ + + private final BigDecimal purchasePrice; + private final BigDecimal salesPrice; + private final BigDecimal quantity; + + /** + * Constructor for SaleCaculator + * + * @param share - The sold share + */ + public SaleCalculator(Share share){ + this.purchasePrice = share.getPurchasePrice(); + this.salesPrice = BigDecimal.ZERO; //TODO: Implement here + this.quantity = share.getQuantity(); + } + + /** + * Method that calculates gross value + * + * @return - BigDecimal of sale price x share quantity + */ + @Override + public BigDecimal calculateGross() { + return salesPrice.multiply(quantity); + } + + /** + * Method that calculates the commission fee + * + * @return - BigDecimal of gross value x 1%. + */ + @Override + public BigDecimal calculateCommision() { + BigDecimal fee = BigDecimal.valueOf(0.01); // Corresponding to 1% + return calculateGross().multiply(fee); + } + + /** + * Method that calculates the tax + * + * @return - BigDecimal of 30% of profit (gross - purchase price x quantity) + */ + @Override + public BigDecimal calculateTax() { + BigDecimal taxPercentage = BigDecimal.valueOf(0.3); // Corresponding to 30% + BigDecimal profit = calculateGross().subtract(purchasePrice.multiply(quantity)); // gross - purchase price x quanitity + return profit.multiply(taxPercentage); + + } + + /** + * Method that calculates the total profit of a sold share + * + * @return - BigDecimal of gross value - commision fee - tax + */ + @Override + public BigDecimal calculateTotal() { + return calculateGross().subtract(calculateCommision()).subtract(calculateTax()); + } + +} From 4eda27a1b10044fd7c9e2d2e9bcf14fcb2fba7f3 Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 15:20:17 +0100 Subject: [PATCH 07/50] chore: Rename package (transaction -> calculator) --- .../idatt/{transaction => calculator}/PurchaseCalculator.java | 2 +- .../idi/idatt/{transaction => calculator}/SaleCalculator.java | 2 +- .../{transaction => calculator}/TransactionCalculator.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/main/java/edu/ntnu/idi/idatt/{transaction => calculator}/PurchaseCalculator.java (97%) rename src/main/java/edu/ntnu/idi/idatt/{transaction => calculator}/SaleCalculator.java (98%) rename src/main/java/edu/ntnu/idi/idatt/{transaction => calculator}/TransactionCalculator.java (94%) diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/PurchaseCalculator.java b/src/main/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculator.java similarity index 97% rename from src/main/java/edu/ntnu/idi/idatt/transaction/PurchaseCalculator.java rename to src/main/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculator.java index cc9bd22..1bd3ae6 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/PurchaseCalculator.java +++ b/src/main/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculator.java @@ -1,4 +1,4 @@ -package edu.ntnu.idi.idatt.transaction; +package edu.ntnu.idi.idatt.calculator; import edu.ntnu.idi.idatt.marked.Share; diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/SaleCalculator.java b/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java similarity index 98% rename from src/main/java/edu/ntnu/idi/idatt/transaction/SaleCalculator.java rename to src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java index 3c83ce3..3f59521 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/SaleCalculator.java +++ b/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java @@ -1,4 +1,4 @@ -package edu.ntnu.idi.idatt.transaction; +package edu.ntnu.idi.idatt.calculator; import edu.ntnu.idi.idatt.marked.Share; diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionCalculator.java b/src/main/java/edu/ntnu/idi/idatt/calculator/TransactionCalculator.java similarity index 94% rename from src/main/java/edu/ntnu/idi/idatt/transaction/TransactionCalculator.java rename to src/main/java/edu/ntnu/idi/idatt/calculator/TransactionCalculator.java index 1818aa8..a1f9265 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionCalculator.java +++ b/src/main/java/edu/ntnu/idi/idatt/calculator/TransactionCalculator.java @@ -1,4 +1,4 @@ -package edu.ntnu.idi.idatt.transaction; +package edu.ntnu.idi.idatt.calculator; import java.math.BigDecimal; From eea854c7fed3a6107c8d1a3bf065fcfa1ebb0a80 Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 15:36:18 +0100 Subject: [PATCH 08/50] feat: Create Transaction abstract class --- .../idi/idatt/transaction/Transaction.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java new file mode 100644 index 0000000..65de1b3 --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java @@ -0,0 +1,65 @@ +package edu.ntnu.idi.idatt.transaction; + +import edu.ntnu.idi.idatt.Player; +import edu.ntnu.idi.idatt.calculator.TransactionCalculator; +import edu.ntnu.idi.idatt.marked.Share; + +/** + * Transaction class + * + *

An abstract class that handles a transaction + * based on week and share. Utilizes the calculators + * to perform calculations.

+ * @see TransactionCalculator + */ +abstract class Transaction { + + private final Share share; + private int week; + private TransactionCalculator calculator; + private boolean commited; + + /** + * Constructor for a Transaction + * + * @param share - The share the transaction is about. + * @param week - The current week + * @param calculator - Transaction (Purchasae/Sale) + */ + Transaction(Share share, int week, TransactionCalculator calculator) { + this.share = share; + this.week = week; + this.calculator = calculator; + } + + /** + * + * Getters + * @return - their corresponding variable + * + */ + + public Share getShare() { + return share; + } + + public int getWeek() { + return week; + } + + public TransactionCalculator getCalculator() { + return calculator; + } + + public boolean isCommited() { + return commited; + } + + /** + * Abstract commit method to set the isCommited flag that symbolizes a unique transaction. + * + * @param player - The player that does the transaction + */ + abstract void commit(Player player); + +} From 0b29c14f47ff3fc5df133fb7d1956dbed8b6bac9 Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 15:36:50 +0100 Subject: [PATCH 09/50] feat: Implement Purchase and Sale classes --- .../ntnu/idi/idatt/transaction/Purchase.java | 28 +++++++++++++++++++ .../edu/ntnu/idi/idatt/transaction/Sale.java | 27 ++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java create mode 100644 src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java new file mode 100644 index 0000000..4b61325 --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java @@ -0,0 +1,28 @@ +package edu.ntnu.idi.idatt.transaction; + +import edu.ntnu.idi.idatt.Player; +import edu.ntnu.idi.idatt.calculator.PurchaseCalculator; +import edu.ntnu.idi.idatt.calculator.TransactionCalculator; +import edu.ntnu.idi.idatt.marked.Share; + +public class Purchase extends Transaction{ + /** + * Constructor for a Purchase + * + * @param share - The purchased share. + * @param week - The current week + */ + Purchase(Share share, int week) { + super(share, week, new PurchaseCalculator(share)); + } + + /** + * @see Transaction + * @param player - The player that does the transaction + */ + @Override + void commit(Player player) { + + } + +} diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java new file mode 100644 index 0000000..9d38c59 --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java @@ -0,0 +1,27 @@ +package edu.ntnu.idi.idatt.transaction; + +import edu.ntnu.idi.idatt.Player; +import edu.ntnu.idi.idatt.calculator.SaleCalculator; +import edu.ntnu.idi.idatt.calculator.TransactionCalculator; +import edu.ntnu.idi.idatt.marked.Share; + +public class Sale extends Transaction{ + /** + * Constructor for a Sale + * + * @param share - The sold share + * @param week - The current week + */ + Sale(Share share, int week) { + super(share, week, new SaleCalculator(share)); + } + + /** + * @see Transaction + * @param player - The player that does the transaction + */ + @Override + void commit(Player player) { + + } +} From 9a3d706eb3f7ee1914e819654365f65a5a84989e Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 15:40:40 +0100 Subject: [PATCH 10/50] Fix: Missing class accessibility scope --- src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java index 65de1b3..d6979c4 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java @@ -12,7 +12,7 @@ * to perform calculations.

* @see TransactionCalculator */ -abstract class Transaction { +public abstract class Transaction { private final Share share; private int week; From b289cbc256791d7f944ae6ac68d4068705af4990 Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 15:48:57 +0100 Subject: [PATCH 11/50] feat: Temporary player class --- src/main/java/edu/ntnu/idi/idatt/Player.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/java/edu/ntnu/idi/idatt/Player.java diff --git a/src/main/java/edu/ntnu/idi/idatt/Player.java b/src/main/java/edu/ntnu/idi/idatt/Player.java new file mode 100644 index 0000000..414f6e8 --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/Player.java @@ -0,0 +1,4 @@ +package edu.ntnu.idi.idatt; + +public class Player { +} From 97932817501df3722e76c02dfa8344abb3debecf Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 15:53:52 +0100 Subject: [PATCH 12/50] feat: Add TransactionArchive class to store per player transaction logic. --- .../idatt/transaction/TransactionArchive.java | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 src/main/java/edu/ntnu/idi/idatt/transaction/TransactionArchive.java diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionArchive.java b/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionArchive.java new file mode 100644 index 0000000..3fbeaa4 --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionArchive.java @@ -0,0 +1,78 @@ +package edu.ntnu.idi.idatt.transaction; + +import java.util.ArrayList; +import java.util.List; + +/** + * TransactionArchive class + * + *

Manages and handles transaction logic

+ * + */ +public class TransactionArchive { + + private final ArrayList transactions = new ArrayList<>(); + + /** + * Method for adding a new transaction to ArrayList transactions. + * + * @param transaction - The transaction instance + * @return - was the list modified? + */ + public boolean add(Transaction transaction){ + return transactions.add(transaction); + } + + /** + * Method for checking if there has been any transactions previously. + * + * @return - was the transactions ArrayList empty? + */ + public boolean isEmpty(){ + return transactions.isEmpty(); + } + + /** + * Getter for transactions done + * + * @param week - Transaction interval + * @return - List of Transaction done in a specified week. + */ + public List getTransactions(int week) { + return transactions.stream().filter(transaction -> transaction.getWeek() == week).toList(); + } + + /** + * Getter for purchases done + * + * @param week - Purchase interval + * @return - List of Purchase done in a specified week. + */ + public List getPurchases(int week) { + return transactions.stream().filter(t -> t instanceof Purchase) + .map(t -> (Purchase) t) + .toList(); + } + + /** + * Getter for sales done + * + * @param week - Sale interval + * @return - List of Sale done in a specified week. + */ + public List getSales(int week) { + return transactions.stream().filter(t -> t instanceof Sale) + .map(t -> (Sale) t) + .toList(); + } + + /** + * Part 2 + * + * @return + */ + public int countDistinctWeeks(){ //TODO: HERE + return -1; + } + +} From 8250eeeed1da2c0a60bcfa766eb60c33ef34b73e Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 15:59:32 +0100 Subject: [PATCH 13/50] feat: Implementation of Player class structure --- src/main/java/edu/ntnu/idi/idatt/Player.java | 52 ++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/main/java/edu/ntnu/idi/idatt/Player.java b/src/main/java/edu/ntnu/idi/idatt/Player.java index 414f6e8..d3a288c 100644 --- a/src/main/java/edu/ntnu/idi/idatt/Player.java +++ b/src/main/java/edu/ntnu/idi/idatt/Player.java @@ -1,4 +1,56 @@ package edu.ntnu.idi.idatt; +import edu.ntnu.idi.idatt.marked.Portfolio; +import edu.ntnu.idi.idatt.transaction.TransactionArchive; + +import java.math.BigDecimal; + public class Player { + + private final String name; + private final BigDecimal startingMoney; + private BigDecimal money; + private Portfolio portfolio; + private TransactionArchive transactionArchive; + + public Player(String name, BigDecimal startingMoney) { + this.name = name; + this.startingMoney = startingMoney; + } + + /** + * Getters + * + * @return - Their corresponding variables. + */ + + public String getName() { + return name; + } + + public BigDecimal getMoney() { + return money; + } + + public Portfolio getPortfolio() { + return portfolio; + } + + public TransactionArchive getTransactionArchive() { + return transactionArchive; + } + + /** + * Setters for money + * + * @param amount - Amount to be changed correspondingly. + */ + + public void addMoney(BigDecimal amount){ + this.money = this.money.add(amount); + } + + public void withdrawMoney(BigDecimal amount){ + this.money = this.money.subtract(amount); + } } From ce4985bfff42394563c9ab488a3602facb78768a Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 16:02:02 +0100 Subject: [PATCH 14/50] fix(Player class): Variable values on instance creation. --- src/main/java/edu/ntnu/idi/idatt/Player.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/Player.java b/src/main/java/edu/ntnu/idi/idatt/Player.java index d3a288c..cb2ae90 100644 --- a/src/main/java/edu/ntnu/idi/idatt/Player.java +++ b/src/main/java/edu/ntnu/idi/idatt/Player.java @@ -10,12 +10,13 @@ public class Player { private final String name; private final BigDecimal startingMoney; private BigDecimal money; - private Portfolio portfolio; - private TransactionArchive transactionArchive; + private Portfolio portfolio = new Portfolio(); + private TransactionArchive transactionArchive = new TransactionArchive(); public Player(String name, BigDecimal startingMoney) { this.name = name; this.startingMoney = startingMoney; + this.money = this.startingMoney; } /** From 777184dddda77a3639cfe6027bd741e23695307c Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 16:09:51 +0100 Subject: [PATCH 15/50] feat: Added commit method bodies to Purchase and Sale --- src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java | 4 ++++ src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java | 4 ++++ src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java index 4b61325..0e4b42e 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java @@ -22,7 +22,11 @@ public class Purchase extends Transaction{ */ @Override void commit(Player player) { + player.withdrawMoney(this.getCalculator().calculateTotal()); + player.getPortfolio().addShare(this.getShare()); + player.getTransactionArchive().add(this); + this.commited = true; } } diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java index 9d38c59..db37325 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java @@ -22,6 +22,10 @@ public class Sale extends Transaction{ */ @Override void commit(Player player) { + player.addMoney(this.getCalculator().calculateTotal()); + player.getPortfolio().removeShare(this.getShare()); + player.getTransactionArchive().add(this); + this.commited = true; } } diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java index d6979c4..2a85dfe 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java @@ -12,12 +12,13 @@ * to perform calculations.

* @see TransactionCalculator */ + public abstract class Transaction { private final Share share; private int week; private TransactionCalculator calculator; - private boolean commited; + protected boolean commited; /** * Constructor for a Transaction From 326ed304c70585e553838051303b8236b6fc6cf4 Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 16:33:28 +0100 Subject: [PATCH 16/50] fix: Accessibility modifiers --- src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java | 4 ++-- src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java | 4 ++-- src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java index 0e4b42e..157c193 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java @@ -12,7 +12,7 @@ public class Purchase extends Transaction{ * @param share - The purchased share. * @param week - The current week */ - Purchase(Share share, int week) { + public Purchase(Share share, int week) { super(share, week, new PurchaseCalculator(share)); } @@ -21,7 +21,7 @@ public class Purchase extends Transaction{ * @param player - The player that does the transaction */ @Override - void commit(Player player) { + public void commit(Player player) { player.withdrawMoney(this.getCalculator().calculateTotal()); player.getPortfolio().addShare(this.getShare()); player.getTransactionArchive().add(this); diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java index db37325..d3dfee2 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java @@ -12,7 +12,7 @@ public class Sale extends Transaction{ * @param share - The sold share * @param week - The current week */ - Sale(Share share, int week) { + public Sale(Share share, int week) { super(share, week, new SaleCalculator(share)); } @@ -21,7 +21,7 @@ public class Sale extends Transaction{ * @param player - The player that does the transaction */ @Override - void commit(Player player) { + public void commit(Player player) { player.addMoney(this.getCalculator().calculateTotal()); player.getPortfolio().removeShare(this.getShare()); player.getTransactionArchive().add(this); diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java index 2a85dfe..1e955fe 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java @@ -61,6 +61,6 @@ public boolean isCommited() { * * @param player - The player that does the transaction */ - abstract void commit(Player player); + abstract public void commit(Player player); } From cf8ebfe7726326c1c7744ae1866fb75ff31f9f98 Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Thu, 12 Feb 2026 16:37:48 +0100 Subject: [PATCH 17/50] feat: Added Exchange class as backbone of the project. --- .../java/edu/ntnu/idi/idatt/Exchange.java | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/main/java/edu/ntnu/idi/idatt/Exchange.java diff --git a/src/main/java/edu/ntnu/idi/idatt/Exchange.java b/src/main/java/edu/ntnu/idi/idatt/Exchange.java new file mode 100644 index 0000000..a159c4a --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/Exchange.java @@ -0,0 +1,81 @@ +package edu.ntnu.idi.idatt; + +import edu.ntnu.idi.idatt.marked.Share; +import edu.ntnu.idi.idatt.marked.Stock; +import edu.ntnu.idi.idatt.transaction.Purchase; +import edu.ntnu.idi.idatt.transaction.Sale; +import edu.ntnu.idi.idatt.transaction.Transaction; + +import java.math.BigDecimal; +import java.util.*; + +public class Exchange { + + //TODO: JavaDocs, Write over functions mby + + private final String name; + private int week; + private HashMap stockMap = new HashMap<>(); + private Random random = new Random(); + + public Exchange(String name, List stocks) { + this.name = name; + this.week = 1; + + for(Stock stock : stocks){ + stockMap.put(stock.getSymbol(), stock); + } + + } + + public String getName() { + return name; + } + + public int getWeek() { + return week; + } + + public boolean hasStock(String symbol) { + return stockMap.containsKey(symbol); + } + + public Stock getStock(String symbol) { + if(this.hasStock(symbol)){ + stockMap.get(symbol); + } + return null; //TODO: Exception + } + + public List findStocks(String searchTerm) { + ArrayList stocksFound = new ArrayList<>(); + + for(Stock stock : stockMap.values()) { + if(stock.getCompany().contains(searchTerm) || stock.getSymbol().contains(searchTerm)){ + stocksFound.add(stock); + } + } + return stocksFound; + } + + public Transaction buy(String symbol, BigDecimal quantity, Player player) { + Share share = new Share(getStock(symbol), quantity, BigDecimal.valueOf(random.nextDouble())); + Purchase purchase = new Purchase(share, this.week); + purchase.commit(player); + return player.getTransactionArchive().getPurchases(this.week).getLast(); + } + + public Transaction sell(Share share, Player player) { + Sale sale = new Sale(share, this.week); + sale.commit(player); + return player.getTransactionArchive().getSales(this.week).getLast(); + } + + public void advance() { + for(Stock stocks : stockMap.values()) { + stocks.addNewSalesPrice(BigDecimal.valueOf(random.nextDouble())); + } + } + + +} From d8020617375ecc21024d8fbcb35337e6047450fa Mon Sep 17 00:00:00 2001 From: pawelsa Date: Fri, 13 Feb 2026 16:43:31 +0100 Subject: [PATCH 18/50] chore: Google java style cleanup (checkstyle) --- .../java/edu/ntnu/idi/idatt/Exchange.java | 103 ++++++++------- src/main/java/edu/ntnu/idi/idatt/Main.java | 2 +- src/main/java/edu/ntnu/idi/idatt/Player.java | 94 +++++++------- .../idatt/calculator/PurchaseCalculator.java | 104 +++++++-------- .../idi/idatt/calculator/SaleCalculator.java | 114 ++++++++--------- .../calculator/TransactionCalculator.java | 18 ++- .../edu/ntnu/idi/idatt/marked/Portfolio.java | 94 +++++++------- .../java/edu/ntnu/idi/idatt/marked/Share.java | 74 +++++------ .../java/edu/ntnu/idi/idatt/marked/Stock.java | 97 +++++++------- .../ntnu/idi/idatt/transaction/Purchase.java | 42 +++---- .../edu/ntnu/idi/idatt/transaction/Sale.java | 42 +++---- .../idi/idatt/transaction/Transaction.java | 89 ++++++------- .../idatt/transaction/TransactionArchive.java | 118 +++++++++--------- 13 files changed, 507 insertions(+), 484 deletions(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/Exchange.java b/src/main/java/edu/ntnu/idi/idatt/Exchange.java index a159c4a..f121509 100644 --- a/src/main/java/edu/ntnu/idi/idatt/Exchange.java +++ b/src/main/java/edu/ntnu/idi/idatt/Exchange.java @@ -11,71 +11,70 @@ public class Exchange { - //TODO: JavaDocs, Write over functions mby + // TODO: JavaDocs, Write over functions mby - private final String name; - private int week; - private HashMap stockMap = new HashMap<>(); - private Random random = new Random(); + private final String name; + private int week; + private HashMap stockMap = new HashMap<>(); + private Random random = new Random(); - public Exchange(String name, List stocks) { - this.name = name; - this.week = 1; - - for(Stock stock : stocks){ - stockMap.put(stock.getSymbol(), stock); - } + public Exchange(String name, List stocks) { + this.name = name; + this.week = 1; + for (Stock stock : stocks) { + stockMap.put(stock.getSymbol(), stock); } - public String getName() { - return name; - } + } - public int getWeek() { - return week; - } + public String getName() { + return name; + } - public boolean hasStock(String symbol) { - return stockMap.containsKey(symbol); - } + public int getWeek() { + return week; + } - public Stock getStock(String symbol) { - if(this.hasStock(symbol)){ - stockMap.get(symbol); - } - return null; //TODO: Exception - } + public boolean hasStock(String symbol) { + return stockMap.containsKey(symbol); + } - public List findStocks(String searchTerm) { - ArrayList stocksFound = new ArrayList<>(); - - for(Stock stock : stockMap.values()) { - if(stock.getCompany().contains(searchTerm) || stock.getSymbol().contains(searchTerm)){ - stocksFound.add(stock); - } - } - return stocksFound; + public Stock getStock(String symbol) { + if (this.hasStock(symbol)) { + stockMap.get(symbol); } + return null; // TODO: Exception + } - public Transaction buy(String symbol, BigDecimal quantity, Player player) { - Share share = new Share(getStock(symbol), quantity, BigDecimal.valueOf(random.nextDouble())); - Purchase purchase = new Purchase(share, this.week); - purchase.commit(player); - return player.getTransactionArchive().getPurchases(this.week).getLast(); - } + public List findStocks(String searchTerm) { + ArrayList stocksFound = new ArrayList<>(); - public Transaction sell(Share share, Player player) { - Sale sale = new Sale(share, this.week); - sale.commit(player); - return player.getTransactionArchive().getSales(this.week).getLast(); + for (Stock stock : stockMap.values()) { + if (stock.getCompany().contains(searchTerm) || stock.getSymbol().contains(searchTerm)) { + stocksFound.add(stock); + } } - - public void advance() { - for(Stock stocks : stockMap.values()) { - stocks.addNewSalesPrice(BigDecimal.valueOf(random.nextDouble())); - } + return stocksFound; + } + + public Transaction buy(String symbol, BigDecimal quantity, Player player) { + Share share = new Share(getStock(symbol), quantity, BigDecimal.valueOf(random.nextDouble())); + Purchase purchase = new Purchase(share, this.week); + purchase.commit(player); + return player.getTransactionArchive().getPurchases(this.week).getLast(); + } + + public Transaction sell(Share share, Player player) { + Sale sale = new Sale(share, this.week); + sale.commit(player); + return player.getTransactionArchive().getSales(this.week).getLast(); + } + + public void advance() { + for (Stock stocks : stockMap.values()) { + stocks.addNewSalesPrice(BigDecimal.valueOf(random.nextDouble())); } - + } } diff --git a/src/main/java/edu/ntnu/idi/idatt/Main.java b/src/main/java/edu/ntnu/idi/idatt/Main.java index 57408d3..a7ee785 100644 --- a/src/main/java/edu/ntnu/idi/idatt/Main.java +++ b/src/main/java/edu/ntnu/idi/idatt/Main.java @@ -8,4 +8,4 @@ static void main() { System.out.println("Hello world!"); } -} \ No newline at end of file +} diff --git a/src/main/java/edu/ntnu/idi/idatt/Player.java b/src/main/java/edu/ntnu/idi/idatt/Player.java index cb2ae90..3a5e61d 100644 --- a/src/main/java/edu/ntnu/idi/idatt/Player.java +++ b/src/main/java/edu/ntnu/idi/idatt/Player.java @@ -7,51 +7,51 @@ public class Player { - private final String name; - private final BigDecimal startingMoney; - private BigDecimal money; - private Portfolio portfolio = new Portfolio(); - private TransactionArchive transactionArchive = new TransactionArchive(); - - public Player(String name, BigDecimal startingMoney) { - this.name = name; - this.startingMoney = startingMoney; - this.money = this.startingMoney; - } - - /** - * Getters - * - * @return - Their corresponding variables. - */ - - public String getName() { - return name; - } - - public BigDecimal getMoney() { - return money; - } - - public Portfolio getPortfolio() { - return portfolio; - } - - public TransactionArchive getTransactionArchive() { - return transactionArchive; - } - - /** - * Setters for money - * - * @param amount - Amount to be changed correspondingly. - */ - - public void addMoney(BigDecimal amount){ - this.money = this.money.add(amount); - } - - public void withdrawMoney(BigDecimal amount){ - this.money = this.money.subtract(amount); - } + private final String name; + private final BigDecimal startingMoney; + private BigDecimal money; + private Portfolio portfolio = new Portfolio(); + private TransactionArchive transactionArchive = new TransactionArchive(); + + public Player(String name, BigDecimal startingMoney) { + this.name = name; + this.startingMoney = startingMoney; + this.money = this.startingMoney; + } + + /** + * Getters + * + * @return - Their corresponding variables. + */ + + public String getName() { + return name; + } + + public BigDecimal getMoney() { + return money; + } + + public Portfolio getPortfolio() { + return portfolio; + } + + public TransactionArchive getTransactionArchive() { + return transactionArchive; + } + + /** + * Setters for money + * + * @param amount - Amount to be changed correspondingly. + */ + + public void addMoney(BigDecimal amount) { + this.money = this.money.add(amount); + } + + public void withdrawMoney(BigDecimal amount) { + this.money = this.money.subtract(amount); + } } diff --git a/src/main/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculator.java b/src/main/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculator.java index 1bd3ae6..33ea3c9 100644 --- a/src/main/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculator.java +++ b/src/main/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculator.java @@ -7,64 +7,66 @@ /** * PurchaseCalculator class * - *

Calculates transaction price based on - * share bought.

+ *

+ * Calculates transaction price based on + * share bought. + *

* */ -public class PurchaseCalculator implements TransactionCalculator{ +public class PurchaseCalculator implements TransactionCalculator { - private final BigDecimal purchasePrice; - private final BigDecimal quantity; + private final BigDecimal purchasePrice; + private final BigDecimal quantity; - /** - * Constructor for PurchaseCalculator - * - * @param share - The bought share - */ - public PurchaseCalculator(Share share){ - this.purchasePrice = share.getPurchasePrice(); - this.quantity = share.getQuantity(); - } + /** + * Constructor for PurchaseCalculator + * + * @param share - The bought share + */ + public PurchaseCalculator(Share share) { + this.purchasePrice = share.getPurchasePrice(); + this.quantity = share.getQuantity(); + } - /** - * Method that calculates gross value - * - * @return - BigDecimal of purchase price x share quantity - */ - @Override - public BigDecimal calculateGross() { - return purchasePrice.multiply(quantity); - } + /** + * Method that calculates gross value + * + * @return - BigDecimal of purchase price x share quantity + */ + @Override + public BigDecimal calculateGross() { + return purchasePrice.multiply(quantity); + } - /** - * Method that calculates the commission fee - * - * @return - BigDecimal of gross value x 0.5%. - */ - @Override - public BigDecimal calculateCommision() { - BigDecimal fee = BigDecimal.valueOf(0.005); // Corresponding to 0.5% - return calculateGross().multiply(fee); - } + /** + * Method that calculates the commission fee + * + * @return - BigDecimal of gross value x 0.5%. + */ + @Override + public BigDecimal calculateCommision() { + BigDecimal fee = BigDecimal.valueOf(0.005); // Corresponding to 0.5% + return calculateGross().multiply(fee); + } - /** - * Method that calculates the tax - * - * @return - BigDecimal of 0 based on project requirements. - */ - @Override - public BigDecimal calculateTax() { - return BigDecimal.ZERO; - } + /** + * Method that calculates the tax + * + * @return - BigDecimal of 0 based on project requirements. + */ + @Override + public BigDecimal calculateTax() { + return BigDecimal.ZERO; + } - /** - * Method that calculates the total price of a bought share - * - * @return - BigDecimal of gross value + commision fee + tax - */ - @Override - public BigDecimal calculateTotal() { - return calculateGross().add(calculateCommision()).add(calculateTax()); - } + /** + * Method that calculates the total price of a bought share + * + * @return - BigDecimal of gross value + commision fee + tax + */ + @Override + public BigDecimal calculateTotal() { + return calculateGross().add(calculateCommision()).add(calculateTax()); + } } diff --git a/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java b/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java index 3f59521..2d77502 100644 --- a/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java +++ b/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java @@ -4,73 +4,75 @@ import java.math.BigDecimal; - /** * SaleCalculator class * - *

Calculates transaction profit based on - * share sold.

+ *

+ * Calculates transaction profit based on + * share sold. + *

* */ -public class SaleCalculator implements TransactionCalculator{ +public class SaleCalculator implements TransactionCalculator { - private final BigDecimal purchasePrice; - private final BigDecimal salesPrice; - private final BigDecimal quantity; + private final BigDecimal purchasePrice; + private final BigDecimal salesPrice; + private final BigDecimal quantity; - /** - * Constructor for SaleCaculator - * - * @param share - The sold share - */ - public SaleCalculator(Share share){ - this.purchasePrice = share.getPurchasePrice(); - this.salesPrice = BigDecimal.ZERO; //TODO: Implement here - this.quantity = share.getQuantity(); - } + /** + * Constructor for SaleCaculator + * + * @param share - The sold share + */ + public SaleCalculator(Share share) { + this.purchasePrice = share.getPurchasePrice(); + this.salesPrice = BigDecimal.ZERO; // TODO: Implement here + this.quantity = share.getQuantity(); + } - /** - * Method that calculates gross value - * - * @return - BigDecimal of sale price x share quantity - */ - @Override - public BigDecimal calculateGross() { - return salesPrice.multiply(quantity); - } + /** + * Method that calculates gross value + * + * @return - BigDecimal of sale price x share quantity + */ + @Override + public BigDecimal calculateGross() { + return salesPrice.multiply(quantity); + } - /** - * Method that calculates the commission fee - * - * @return - BigDecimal of gross value x 1%. - */ - @Override - public BigDecimal calculateCommision() { - BigDecimal fee = BigDecimal.valueOf(0.01); // Corresponding to 1% - return calculateGross().multiply(fee); - } + /** + * Method that calculates the commission fee + * + * @return - BigDecimal of gross value x 1%. + */ + @Override + public BigDecimal calculateCommision() { + BigDecimal fee = BigDecimal.valueOf(0.01); // Corresponding to 1% + return calculateGross().multiply(fee); + } - /** - * Method that calculates the tax - * - * @return - BigDecimal of 30% of profit (gross - purchase price x quantity) - */ - @Override - public BigDecimal calculateTax() { - BigDecimal taxPercentage = BigDecimal.valueOf(0.3); // Corresponding to 30% - BigDecimal profit = calculateGross().subtract(purchasePrice.multiply(quantity)); // gross - purchase price x quanitity - return profit.multiply(taxPercentage); + /** + * Method that calculates the tax + * + * @return - BigDecimal of 30% of profit (gross - purchase price x quantity) + */ + @Override + public BigDecimal calculateTax() { + BigDecimal taxPercentage = BigDecimal.valueOf(0.3); // Corresponding to 30% + BigDecimal profit = calculateGross().subtract(purchasePrice.multiply(quantity)); // gross - purchase price x + // quanitity + return profit.multiply(taxPercentage); - } + } - /** - * Method that calculates the total profit of a sold share - * - * @return - BigDecimal of gross value - commision fee - tax - */ - @Override - public BigDecimal calculateTotal() { - return calculateGross().subtract(calculateCommision()).subtract(calculateTax()); - } + /** + * Method that calculates the total profit of a sold share + * + * @return - BigDecimal of gross value - commision fee - tax + */ + @Override + public BigDecimal calculateTotal() { + return calculateGross().subtract(calculateCommision()).subtract(calculateTax()); + } } diff --git a/src/main/java/edu/ntnu/idi/idatt/calculator/TransactionCalculator.java b/src/main/java/edu/ntnu/idi/idatt/calculator/TransactionCalculator.java index a1f9265..fdfa9b1 100644 --- a/src/main/java/edu/ntnu/idi/idatt/calculator/TransactionCalculator.java +++ b/src/main/java/edu/ntnu/idi/idatt/calculator/TransactionCalculator.java @@ -5,17 +5,23 @@ /** * TransactionCalculator interface * - *

Contains methods that are used upon doing a transaction - * corresponding to a share and a week.

+ *

+ * Contains methods that are used upon doing a transaction + * corresponding to a share and a week. + *

+ * * @see PurchaseCalculator * @see SaleCalculator * */ public interface TransactionCalculator { - BigDecimal calculateGross(); // Gross - Norsk: verdi før avgifter - BigDecimal calculateCommision(); // Commision - Norsk: (Kurtasje) En avgift som betales til megleren. - BigDecimal calculateTax(); // Tax - Norsk: Skatt, en avgift som betales til staten. - BigDecimal calculateTotal(); // Totalverdi etter avgifter + BigDecimal calculateGross(); // Gross - Norsk: verdi før avgifter + + BigDecimal calculateCommision(); // Commision - Norsk: (Kurtasje) En avgift som betales til megleren. + + BigDecimal calculateTax(); // Tax - Norsk: Skatt, en avgift som betales til staten. + + BigDecimal calculateTotal(); // Totalverdi etter avgifter } diff --git a/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java b/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java index 535259b..f89c5cc 100644 --- a/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java +++ b/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java @@ -6,60 +6,62 @@ /** * Portfolio class * - *

Class that functions as a wallet for a player - * storing all results of transactions made.

+ *

+ * Class that functions as a wallet for a player + * storing all results of transactions made. + *

* */ public class Portfolio { - private ArrayList shares; + private ArrayList shares; - /** - * Setter for ArrayList shares. - * - * @param share - The bought share - * @return - was the list modified? - */ - public boolean addShare(Share share){ - return shares.add(share); - } + /** + * Setter for ArrayList shares. + * + * @param share - The bought share + * @return - was the list modified? + */ + public boolean addShare(Share share) { + return shares.add(share); + } - /** - * Setter for ArrayList shares. - * - * @param share - The sold share - * @return - was the list modified? - */ - public boolean removeShare(Share share){ - return shares.add(share); - } + /** + * Setter for ArrayList shares. + * + * @param share - The sold share + * @return - was the list modified? + */ + public boolean removeShare(Share share) { + return shares.add(share); + } - /** - * Getter for ArrayList shares. - * - * @return - List of all shares owned. - */ - public List getShares() { - return shares; - } + /** + * Getter for ArrayList shares. + * + * @return - List of all shares owned. + */ + public List getShares() { + return shares; + } - /** - * Getter for ArrayList shares. - * - * @param symbol - The symbol of the stock corresponding to the share. - * @return - List of shares owned that corresponds with a company symbol. - */ - public List getShares(String symbol) { - return shares.stream().filter(s -> s.getStock().getSymbol().equals(symbol)).toList(); - } + /** + * Getter for ArrayList shares. + * + * @param symbol - The symbol of the stock corresponding to the share. + * @return - List of shares owned that corresponds with a company symbol. + */ + public List getShares(String symbol) { + return shares.stream().filter(s -> s.getStock().getSymbol().equals(symbol)).toList(); + } - /** - * Method for checking if the portfolio contains a specific share - * - * @return - If the share was found. - */ - public boolean contains(Share share) { - return shares.contains(share); - } + /** + * Method for checking if the portfolio contains a specific share + * + * @return - If the share was found. + */ + public boolean contains(Share share) { + return shares.contains(share); + } } diff --git a/src/main/java/edu/ntnu/idi/idatt/marked/Share.java b/src/main/java/edu/ntnu/idi/idatt/marked/Share.java index 1f9c14b..0cc7432 100644 --- a/src/main/java/edu/ntnu/idi/idatt/marked/Share.java +++ b/src/main/java/edu/ntnu/idi/idatt/marked/Share.java @@ -5,45 +5,47 @@ /** * Share class * - *

Class that describes the ownership of a specific stock.

+ *

+ * Class that describes the ownership of a specific stock. + *

* */ public class Share { - private final Stock stock; - private BigDecimal quantity; - private BigDecimal purchasePrice; - - /** - * Constructor for a Share. - * - * @param stock - The stock this share corresponds to. - * @see Stock - * @param quantity - The total of bought shares of the stock. - * @param purchasePrice - The current price when the stock was bought. - */ - public Share(Stock stock, BigDecimal quantity, BigDecimal purchasePrice) { - this.stock = stock; - this.quantity = quantity; - this.purchasePrice = purchasePrice; - } - - /** - * Getters - * - * @return - Their corresponding variables. - */ - - public Stock getStock() { - return stock; - } - - public BigDecimal getQuantity() { - return quantity; - } - - public BigDecimal getPurchasePrice() { - return purchasePrice; - } + private final Stock stock; + private BigDecimal quantity; + private BigDecimal purchasePrice; + + /** + * Constructor for a Share. + * + * @param stock - The stock this share corresponds to. + * @see Stock + * @param quantity - The total of bought shares of the stock. + * @param purchasePrice - The current price when the stock was bought. + */ + public Share(Stock stock, BigDecimal quantity, BigDecimal purchasePrice) { + this.stock = stock; + this.quantity = quantity; + this.purchasePrice = purchasePrice; + } + + /** + * Getters + * + * @return - Their corresponding variables. + */ + + public Stock getStock() { + return stock; + } + + public BigDecimal getQuantity() { + return quantity; + } + + public BigDecimal getPurchasePrice() { + return purchasePrice; + } } diff --git a/src/main/java/edu/ntnu/idi/idatt/marked/Stock.java b/src/main/java/edu/ntnu/idi/idatt/marked/Stock.java index 11ca9f8..2ba84b8 100644 --- a/src/main/java/edu/ntnu/idi/idatt/marked/Stock.java +++ b/src/main/java/edu/ntnu/idi/idatt/marked/Stock.java @@ -1,68 +1,71 @@ package edu.ntnu.idi.idatt.marked; - import java.math.BigDecimal; import java.util.List; /** * Stock class * - *

Class that describes an object of a unique stock.

+ *

+ * Class that describes an object of a unique stock. + *

* */ public class Stock { - private final String symbol; - private final String company; - private final List prices; + private final String symbol; + private final String company; + private final List prices; - /** - * Constructor for a Stock. - * - * @param symbol - String that indicates the symbol of a stock, ex. "APPL" as a short form of company. - * @param company - String, company name, ex. "Apple Inc." - * @param prices - An array of BigInteger that indicates the price corresponding with time. - */ - public Stock(String symbol, String company, List prices) { - this.symbol = symbol; - this.company = company; - this.prices = prices; - } + /** + * Constructor for a Stock. + * + * @param symbol - String that indicates the symbol of a stock, ex. "APPL" as a + * short form of company. + * @param company - String, company name, ex. "Apple Inc." + * @param prices - An array of BigInteger that indicates the price + * corresponding with time. + */ + public Stock(String symbol, String company, List prices) { + this.symbol = symbol; + this.company = company; + this.prices = prices; + } - /** - * Getters - * - * @return - Their corresponding variables. - */ + /** + * Getters + * + * @return - Their corresponding variables. + */ - public String getSymbol() { - return symbol; - } + public String getSymbol() { + return symbol; + } - public String getCompany() { - return company; - } + public String getCompany() { + return company; + } - public List getPrices() { - return prices; - } + public List getPrices() { + return prices; + } - /** - * Getter for sale price - * - * @return - BigDecimal with current (newest in array) stock price. - */ - public BigDecimal getSalesPrice() { - return prices.getLast(); - } + /** + * Getter for sale price + * + * @return - BigDecimal with current (newest in array) stock price. + */ + public BigDecimal getSalesPrice() { + return prices.getLast(); + } - /** - * Method that adds new price to the price array. - * - * @param price - BigDecimal, new price. - */ - public void addNewSalesPrice(BigDecimal price) { - prices.add(price); - } + /** + * Method that adds new price to the price array. + * + * @param price - BigDecimal, new price. + */ + public void addNewSalesPrice(BigDecimal price) { + prices.add(price); + } } diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java index 157c193..f59127e 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java @@ -5,28 +5,28 @@ import edu.ntnu.idi.idatt.calculator.TransactionCalculator; import edu.ntnu.idi.idatt.marked.Share; -public class Purchase extends Transaction{ - /** - * Constructor for a Purchase - * - * @param share - The purchased share. - * @param week - The current week - */ - public Purchase(Share share, int week) { - super(share, week, new PurchaseCalculator(share)); - } +public class Purchase extends Transaction { + /** + * Constructor for a Purchase + * + * @param share - The purchased share. + * @param week - The current week + */ + public Purchase(Share share, int week) { + super(share, week, new PurchaseCalculator(share)); + } - /** - * @see Transaction - * @param player - The player that does the transaction - */ - @Override - public void commit(Player player) { - player.withdrawMoney(this.getCalculator().calculateTotal()); - player.getPortfolio().addShare(this.getShare()); - player.getTransactionArchive().add(this); + /** + * @see Transaction + * @param player - The player that does the transaction + */ + @Override + public void commit(Player player) { + player.withdrawMoney(this.getCalculator().calculateTotal()); + player.getPortfolio().addShare(this.getShare()); + player.getTransactionArchive().add(this); - this.commited = true; - } + this.commited = true; + } } diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java index d3dfee2..75f195c 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java @@ -5,27 +5,27 @@ import edu.ntnu.idi.idatt.calculator.TransactionCalculator; import edu.ntnu.idi.idatt.marked.Share; -public class Sale extends Transaction{ - /** - * Constructor for a Sale - * - * @param share - The sold share - * @param week - The current week - */ - public Sale(Share share, int week) { - super(share, week, new SaleCalculator(share)); - } +public class Sale extends Transaction { + /** + * Constructor for a Sale + * + * @param share - The sold share + * @param week - The current week + */ + public Sale(Share share, int week) { + super(share, week, new SaleCalculator(share)); + } - /** - * @see Transaction - * @param player - The player that does the transaction - */ - @Override - public void commit(Player player) { - player.addMoney(this.getCalculator().calculateTotal()); - player.getPortfolio().removeShare(this.getShare()); - player.getTransactionArchive().add(this); + /** + * @see Transaction + * @param player - The player that does the transaction + */ + @Override + public void commit(Player player) { + player.addMoney(this.getCalculator().calculateTotal()); + player.getPortfolio().removeShare(this.getShare()); + player.getTransactionArchive().add(this); - this.commited = true; - } + this.commited = true; + } } diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java index 1e955fe..f28629e 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Transaction.java @@ -7,60 +7,65 @@ /** * Transaction class * - *

An abstract class that handles a transaction + *

+ * An abstract class that handles a transaction * based on week and share. Utilizes the calculators - * to perform calculations.

+ * to perform calculations. + *

+ * * @see TransactionCalculator */ public abstract class Transaction { - private final Share share; - private int week; - private TransactionCalculator calculator; - protected boolean commited; + private final Share share; + private int week; + private TransactionCalculator calculator; + protected boolean commited; - /** - * Constructor for a Transaction - * - * @param share - The share the transaction is about. - * @param week - The current week - * @param calculator - Transaction (Purchasae/Sale) - */ - Transaction(Share share, int week, TransactionCalculator calculator) { - this.share = share; - this.week = week; - this.calculator = calculator; - } + /** + * Constructor for a Transaction + * + * @param share - The share the transaction is about. + * @param week - The current week + * @param calculator - Transaction (Purchasae/Sale) + */ + Transaction(Share share, int week, TransactionCalculator calculator) { + this.share = share; + this.week = week; + this.calculator = calculator; + } - /** - * - * Getters - * @return - their corresponding variable - * - */ + /** + * + * Getters + * + * @return - their corresponding variable + * + */ - public Share getShare() { - return share; - } + public Share getShare() { + return share; + } - public int getWeek() { - return week; - } + public int getWeek() { + return week; + } - public TransactionCalculator getCalculator() { - return calculator; - } + public TransactionCalculator getCalculator() { + return calculator; + } - public boolean isCommited() { - return commited; - } + public boolean isCommited() { + return commited; + } - /** - * Abstract commit method to set the isCommited flag that symbolizes a unique transaction. - * - * @param player - The player that does the transaction - */ - abstract public void commit(Player player); + /** + * Abstract commit method to set the isCommited flag that symbolizes a unique + * transaction. + * + * @param player - The player that does the transaction + */ + abstract public void commit(Player player); } diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionArchive.java b/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionArchive.java index 3fbeaa4..c53fa81 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionArchive.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionArchive.java @@ -6,73 +6,75 @@ /** * TransactionArchive class * - *

Manages and handles transaction logic

+ *

+ * Manages and handles transaction logic + *

* */ public class TransactionArchive { - private final ArrayList transactions = new ArrayList<>(); + private final ArrayList transactions = new ArrayList<>(); - /** - * Method for adding a new transaction to ArrayList transactions. - * - * @param transaction - The transaction instance - * @return - was the list modified? - */ - public boolean add(Transaction transaction){ - return transactions.add(transaction); - } + /** + * Method for adding a new transaction to ArrayList transactions. + * + * @param transaction - The transaction instance + * @return - was the list modified? + */ + public boolean add(Transaction transaction) { + return transactions.add(transaction); + } - /** - * Method for checking if there has been any transactions previously. - * - * @return - was the transactions ArrayList empty? - */ - public boolean isEmpty(){ - return transactions.isEmpty(); - } + /** + * Method for checking if there has been any transactions previously. + * + * @return - was the transactions ArrayList empty? + */ + public boolean isEmpty() { + return transactions.isEmpty(); + } - /** - * Getter for transactions done - * - * @param week - Transaction interval - * @return - List of Transaction done in a specified week. - */ - public List getTransactions(int week) { - return transactions.stream().filter(transaction -> transaction.getWeek() == week).toList(); - } + /** + * Getter for transactions done + * + * @param week - Transaction interval + * @return - List of Transaction done in a specified week. + */ + public List getTransactions(int week) { + return transactions.stream().filter(transaction -> transaction.getWeek() == week).toList(); + } - /** - * Getter for purchases done - * - * @param week - Purchase interval - * @return - List of Purchase done in a specified week. - */ - public List getPurchases(int week) { - return transactions.stream().filter(t -> t instanceof Purchase) - .map(t -> (Purchase) t) - .toList(); - } + /** + * Getter for purchases done + * + * @param week - Purchase interval + * @return - List of Purchase done in a specified week. + */ + public List getPurchases(int week) { + return transactions.stream().filter(t -> t instanceof Purchase) + .map(t -> (Purchase) t) + .toList(); + } - /** - * Getter for sales done - * - * @param week - Sale interval - * @return - List of Sale done in a specified week. - */ - public List getSales(int week) { - return transactions.stream().filter(t -> t instanceof Sale) - .map(t -> (Sale) t) - .toList(); - } + /** + * Getter for sales done + * + * @param week - Sale interval + * @return - List of Sale done in a specified week. + */ + public List getSales(int week) { + return transactions.stream().filter(t -> t instanceof Sale) + .map(t -> (Sale) t) + .toList(); + } - /** - * Part 2 - * - * @return - */ - public int countDistinctWeeks(){ //TODO: HERE - return -1; - } + /** + * Part 2 + * + * @return + */ + public int countDistinctWeeks() { // TODO: HERE + return -1; + } } From a4e968c38bd96b87821c4e12b60d93fc92a8d653 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Fri, 13 Feb 2026 17:15:16 +0100 Subject: [PATCH 19/50] chore: Set unspecified variable --- src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java b/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java index 2d77502..1df1f61 100644 --- a/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java +++ b/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java @@ -26,7 +26,7 @@ public class SaleCalculator implements TransactionCalculator { */ public SaleCalculator(Share share) { this.purchasePrice = share.getPurchasePrice(); - this.salesPrice = BigDecimal.ZERO; // TODO: Implement here + this.salesPrice = share.getStock().getSalesPrice(); this.quantity = share.getQuantity(); } From b30e599858dc8d4b4ef24f05ee3c1760229acbdf Mon Sep 17 00:00:00 2001 From: pawelsa Date: Fri, 13 Feb 2026 17:23:20 +0100 Subject: [PATCH 20/50] chore: JavaDocs, Set unspecified return. --- .../java/edu/ntnu/idi/idatt/Exchange.java | 87 ++++++++++++++++++- 1 file changed, 84 insertions(+), 3 deletions(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/Exchange.java b/src/main/java/edu/ntnu/idi/idatt/Exchange.java index f121509..318b69f 100644 --- a/src/main/java/edu/ntnu/idi/idatt/Exchange.java +++ b/src/main/java/edu/ntnu/idi/idatt/Exchange.java @@ -9,15 +9,29 @@ import java.math.BigDecimal; import java.util.*; +/** + * Exchange class + * + *

+ * Class that keeps the 'stock game' gameloop. + * Contains methods for managing game states aswell as performing + * all functionality. + *

+ * + */ public class Exchange { - // TODO: JavaDocs, Write over functions mby - private final String name; private int week; private HashMap stockMap = new HashMap<>(); private Random random = new Random(); + /** + * Constructor for Exchange class + * + * @param name - Name of the current stock Exchange + * @param stocks - List of aviable stocks for this exchange. + */ public Exchange(String name, List stocks) { this.name = name; this.week = 1; @@ -28,6 +42,13 @@ public Exchange(String name, List stocks) { } + /** + * + * Getters + * + * @return - their corresponding variables. + */ + public String getName() { return name; } @@ -36,17 +57,37 @@ public int getWeek() { return week; } + /** + * Method for checking if a specific stock exists in the exchange. + * + * @param symbol - String symbol of a specific stock. + * @return - true/false if the exchange has the specific stock. + */ public boolean hasStock(String symbol) { return stockMap.containsKey(symbol); } + /** + * Getter for a specific stock. + * + * @param symbol - String symbol of a specific stock. + * @return - The found stock if existant. + * @throws IllegalArgumentException if invalid symbol given. + */ public Stock getStock(String symbol) { if (this.hasStock(symbol)) { stockMap.get(symbol); } - return null; // TODO: Exception + throw new IllegalArgumentException("This stock doesn't exist in [" + name + "] exchange."); } + /** + * Method for searching after stocks. + * + * @param searchTerm - String or character sequence of corporation name / + * corresponding symbol. + * @return - List of found stocks. + */ public List findStocks(String searchTerm) { ArrayList stocksFound = new ArrayList<>(); @@ -58,6 +99,22 @@ public List findStocks(String searchTerm) { return stocksFound; } + /** + * Method to allow a player to buy a stock. + * + *

+ * Executes a purchase for a player which executes all logic + * and management of money, portfolio and archive. + *

+ * + * @see Purchase + * + * @param symbol - The symbol of the bought stock. + * @param quantity - The amount of a bought stock. + * @param player - which player did this event. + * @return The given transaction details. (Transaction). + * @see Transaction + */ public Transaction buy(String symbol, BigDecimal quantity, Player player) { Share share = new Share(getStock(symbol), quantity, BigDecimal.valueOf(random.nextDouble())); Purchase purchase = new Purchase(share, this.week); @@ -65,12 +122,36 @@ public Transaction buy(String symbol, BigDecimal quantity, Player player) { return player.getTransactionArchive().getPurchases(this.week).getLast(); } + /** + * Method to allow a player to sell a stock. + * + *

+ * Executes a sale for a player which executes all logic + * and management of money, portfolio and archive. + *

+ * + * @see Sale + * + * @param Share - The instance of the sold share. + * @param player - which player did this event. + * @return The given transaction details. (Transaction). + * @see Transaction + */ public Transaction sell(Share share, Player player) { Sale sale = new Sale(share, this.week); sale.commit(player); return player.getTransactionArchive().getSales(this.week).getLast(); } + /** + * Method to advance the gameloop. + * + *

+ * Adds a new price to each of the stock array. + *

+ * + * @see Stock + */ public void advance() { for (Stock stocks : stockMap.values()) { stocks.addNewSalesPrice(BigDecimal.valueOf(random.nextDouble())); From 766a14128d542b41dadbb2e1f06edc6b95bc1e53 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Fri, 13 Feb 2026 17:28:18 +0100 Subject: [PATCH 21/50] chore(Purchase, Sale): Add JavaDoc and reorganize imports. --- .../edu/ntnu/idi/idatt/transaction/Purchase.java | 12 +++++++++++- .../java/edu/ntnu/idi/idatt/transaction/Sale.java | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java index f59127e..ac9152f 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Purchase.java @@ -2,9 +2,19 @@ import edu.ntnu.idi.idatt.Player; import edu.ntnu.idi.idatt.calculator.PurchaseCalculator; -import edu.ntnu.idi.idatt.calculator.TransactionCalculator; import edu.ntnu.idi.idatt.marked.Share; +/** + * Purchase class + * + *

+ * Manages player state at purhcasing stocks. + * Collected as detail in TransactionArchive. + *

+ * + * @see Transaction + * @see TransactionArchive + */ public class Purchase extends Transaction { /** * Constructor for a Purchase diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java b/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java index 75f195c..e0b6292 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/Sale.java @@ -2,9 +2,19 @@ import edu.ntnu.idi.idatt.Player; import edu.ntnu.idi.idatt.calculator.SaleCalculator; -import edu.ntnu.idi.idatt.calculator.TransactionCalculator; import edu.ntnu.idi.idatt.marked.Share; +/** + * Sale class + * + *

+ * Manages player state at selling stocks. + * Collected as detail in TransactionArchive. + *

+ * + * @see Transaction + * @see TransactionArchive + */ public class Sale extends Transaction { /** * Constructor for a Sale From f25f4fb1fa7c9b208d434680729681b60a62e0e5 Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Fri, 13 Feb 2026 22:22:27 +0100 Subject: [PATCH 22/50] feat: add JUnit tests structure --- src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java | 4 ++++ src/test/java/edu/ntnu/idi/idatt/PlayerTest.java | 4 ++++ .../edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java | 4 ++++ .../edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java | 4 ++++ src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java | 4 ++++ src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java | 4 ++++ src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java | 4 ++++ .../java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java | 4 ++++ src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java | 4 ++++ .../ntnu/idi/idatt/transaction/TransactionArchiveTest.java | 4 ++++ .../java/edu/ntnu/idi/idatt/transaction/TransactionTest.java | 4 ++++ 11 files changed, 44 insertions(+) create mode 100644 src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java create mode 100644 src/test/java/edu/ntnu/idi/idatt/PlayerTest.java create mode 100644 src/test/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java create mode 100644 src/test/java/edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java create mode 100644 src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java create mode 100644 src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java create mode 100644 src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java create mode 100644 src/test/java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java create mode 100644 src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java create mode 100644 src/test/java/edu/ntnu/idi/idatt/transaction/TransactionArchiveTest.java create mode 100644 src/test/java/edu/ntnu/idi/idatt/transaction/TransactionTest.java diff --git a/src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java b/src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java new file mode 100644 index 0000000..153f079 --- /dev/null +++ b/src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java @@ -0,0 +1,4 @@ +package edu.ntnu.idi.idatt; + +class ExchangeTest { +} diff --git a/src/test/java/edu/ntnu/idi/idatt/PlayerTest.java b/src/test/java/edu/ntnu/idi/idatt/PlayerTest.java new file mode 100644 index 0000000..d6bab4b --- /dev/null +++ b/src/test/java/edu/ntnu/idi/idatt/PlayerTest.java @@ -0,0 +1,4 @@ +package edu.ntnu.idi.idatt; + +class PlayerTest { +} diff --git a/src/test/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java b/src/test/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java new file mode 100644 index 0000000..c69b00a --- /dev/null +++ b/src/test/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java @@ -0,0 +1,4 @@ +package edu.ntnu.idi.idatt.calculator; + +class PurchaseCalculatorTest { +} diff --git a/src/test/java/edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java b/src/test/java/edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java new file mode 100644 index 0000000..71b9be1 --- /dev/null +++ b/src/test/java/edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java @@ -0,0 +1,4 @@ +package edu.ntnu.idi.idatt.calculator; + +class SaleCalculatorTest { +} diff --git a/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java b/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java new file mode 100644 index 0000000..c95d82a --- /dev/null +++ b/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java @@ -0,0 +1,4 @@ +package edu.ntnu.idi.idatt.marked; + +public class PortfolioTest { +} diff --git a/src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java b/src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java new file mode 100644 index 0000000..9025960 --- /dev/null +++ b/src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java @@ -0,0 +1,4 @@ +package edu.ntnu.idi.idatt.marked; + +public class ShareTest { +} diff --git a/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java b/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java new file mode 100644 index 0000000..76d2c24 --- /dev/null +++ b/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java @@ -0,0 +1,4 @@ +package edu.ntnu.idi.idatt.marked; + +class StockTest { +} diff --git a/src/test/java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java b/src/test/java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java new file mode 100644 index 0000000..aeab4fc --- /dev/null +++ b/src/test/java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java @@ -0,0 +1,4 @@ +package edu.ntnu.idi.idatt.transaction; + +class PurchaseTest { +} diff --git a/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java b/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java new file mode 100644 index 0000000..c69a039 --- /dev/null +++ b/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java @@ -0,0 +1,4 @@ +package edu.ntnu.idi.idatt.transaction; + +class SaleTest { +} diff --git a/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionArchiveTest.java b/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionArchiveTest.java new file mode 100644 index 0000000..0ad836e --- /dev/null +++ b/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionArchiveTest.java @@ -0,0 +1,4 @@ +package edu.ntnu.idi.idatt.transaction; + +class TransactionArchiveTest { +} diff --git a/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionTest.java b/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionTest.java new file mode 100644 index 0000000..a1232b0 --- /dev/null +++ b/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionTest.java @@ -0,0 +1,4 @@ +package edu.ntnu.idi.idatt.transaction; + +class TransactionTest { +} From df77f35b6fee6d3e9f81fdbd12be65a30d771cf6 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Fri, 13 Feb 2026 23:26:27 +0100 Subject: [PATCH 23/50] fix: pom.xml dependency/plugins reorganization --- pom.xml | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 1cf199e..467f022 100644 --- a/pom.xml +++ b/pom.xml @@ -20,13 +20,7 @@ maven-compiler-plugin 3.14.1 - - - org.apache.maven.plugins - maven-surefire-plugin - 3.5.4 - - + org.apache.maven.plugins maven-javadoc-plugin @@ -39,12 +33,27 @@ 25.0.1 + + org.junit.jupiter + junit-jupiter + 6.0.1 + test + + + - + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.5.4 + + org.openjfx @@ -78,13 +87,7 @@ - - org.junit.jupiter - junit-jupiter - 6.0.1 - - - + - \ No newline at end of file + From 6ca4068455a5dc27656dfddc18cce213396e44d7 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Fri, 13 Feb 2026 23:49:21 +0100 Subject: [PATCH 24/50] feat(Stock): Add initial tests and fix corresponding class. --- .../java/edu/ntnu/idi/idatt/marked/Stock.java | 5 +- .../edu/ntnu/idi/idatt/marked/StockTest.java | 47 ++++++++++++++++++- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/marked/Stock.java b/src/main/java/edu/ntnu/idi/idatt/marked/Stock.java index 2ba84b8..40f071e 100644 --- a/src/main/java/edu/ntnu/idi/idatt/marked/Stock.java +++ b/src/main/java/edu/ntnu/idi/idatt/marked/Stock.java @@ -1,6 +1,7 @@ package edu.ntnu.idi.idatt.marked; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.List; /** @@ -15,7 +16,7 @@ public class Stock { private final String symbol; private final String company; - private final List prices; + private final ArrayList prices = new ArrayList<>(); /** * Constructor for a Stock. @@ -29,7 +30,7 @@ public class Stock { public Stock(String symbol, String company, List prices) { this.symbol = symbol; this.company = company; - this.prices = prices; + this.prices.addAll(prices); } /** diff --git a/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java b/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java index 76d2c24..ec226c4 100644 --- a/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java @@ -1,4 +1,49 @@ package edu.ntnu.idi.idatt.marked; -class StockTest { +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.math.BigDecimal; +import java.util.List; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * Alias definitions + * PT - Positive test/s + * + */ + +public class StockTest { + + private Stock stock; + + @BeforeEach + public void PT_setup() { + List prices = List.of(BigDecimal.valueOf(46.2), + BigDecimal.valueOf(40.0)); + stock = new Stock("AAPL", "Apple Inc.", prices); + + } + + @Test + void constructorTest() { + assertEquals("AAPL", stock.getSymbol()); + assertEquals("Apple Inc.", stock.getCompany()); + + assertEquals(List.of(BigDecimal.valueOf(46.2), + BigDecimal.valueOf(40.0)), stock.getPrices()); + + assertEquals(BigDecimal.valueOf(40.0), stock.getSalesPrice()); + } + + @Test + void addNewSalesPriceTest() { + BigDecimal value = BigDecimal.valueOf(15.6); + stock.addNewSalesPrice(value); + + assertEquals(value, stock.getSalesPrice()); + } + } From b5f06fb8f04cbe6752491f63b30601398021eca6 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Fri, 13 Feb 2026 23:59:31 +0100 Subject: [PATCH 25/50] feat(Share): Add initial tests. --- .../edu/ntnu/idi/idatt/marked/ShareTest.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java b/src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java index 9025960..3af2df2 100644 --- a/src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java @@ -1,4 +1,37 @@ package edu.ntnu.idi.idatt.marked; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.math.BigDecimal; +import java.util.List; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + public class ShareTest { + + private Share share; + private Stock stock; + + @BeforeEach + public void PT_setup() { + List prices = List.of(BigDecimal.valueOf(46.2), + BigDecimal.valueOf(40.0)); + stock = new Stock("AAPL", "Apple Inc.", prices); + + // Share parameters + BigDecimal quantity = BigDecimal.valueOf(3.3); + + share = new Share(stock, quantity, stock.getSalesPrice()); + } + + @Test + void constructorTest() { + + assertEquals(stock, share.getStock()); + assertEquals(BigDecimal.valueOf(3.3), share.getQuantity()); + assertEquals(stock.getSalesPrice(), share.getPurchasePrice()); + + } + } From cbda1fb87d7666d2f5cebbe424e2609b42d929f5 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Sat, 14 Feb 2026 17:01:17 +0100 Subject: [PATCH 26/50] feat(Portfolio): Add initial tests and fix corresponding class. --- .../edu/ntnu/idi/idatt/marked/Portfolio.java | 4 +- .../ntnu/idi/idatt/marked/PortfolioTest.java | 79 +++++++++++++++++++ 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java b/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java index f89c5cc..e1385e2 100644 --- a/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java +++ b/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java @@ -14,7 +14,7 @@ */ public class Portfolio { - private ArrayList shares; + private ArrayList shares = new ArrayList<>(); /** * Setter for ArrayList shares. @@ -33,7 +33,7 @@ public boolean addShare(Share share) { * @return - was the list modified? */ public boolean removeShare(Share share) { - return shares.add(share); + return shares.remove(share); } /** diff --git a/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java b/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java index c95d82a..24c22d9 100644 --- a/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java @@ -1,4 +1,83 @@ package edu.ntnu.idi.idatt.marked; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.math.BigDecimal; +import java.util.List; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * Test for Portfolio class + * + *

+ * Tests done linearly with @BeforeAll, checking + * if functionality works as a whole, + *

+ */ + public class PortfolioTest { + + private Stock stock; + private Share share; + private Portfolio portfolio; + + @BeforeEach + public void PT_setup() { + // stock instance and parameters + List prices = List.of(BigDecimal.valueOf(46.2), + BigDecimal.valueOf(40.0)); + stock = new Stock("AAPL", "Apple Inc.", prices); + + // Share instance parameters + BigDecimal quantity = BigDecimal.valueOf(3.3); + share = new Share(stock, quantity, stock.getSalesPrice()); + + // Portfolio instance + portfolio = new Portfolio(); + } + + @Test + void PTaddShare() { + + assertTrue(portfolio.addShare(share)); + assertEquals(List.of(share), portfolio.getShares()); + + } + + void addDefaultShare() { // Since PTaddShare test works, we will use this to initialize + // the rest of the tests under. + portfolio.addShare(share); + } + + @Test + void PTgetSharesBySymbol() { + addDefaultShare(); + + assertEquals(List.of(), portfolio.getShares("SYMBL")); + assertEquals(List.of(share), portfolio.getShares("AAPL")); + + } + + @Test + void PTremoveShare() { + addDefaultShare(); + + assertTrue(portfolio.removeShare(share)); + assertEquals(List.of(), portfolio.getShares()); + + } + + @Test + void PTContains() { + assertFalse(portfolio.contains(share)); + + portfolio.addShare(share); + + assertTrue(portfolio.contains(share)); + } + } From 5ab252d52bd349b6973e0b702ef057a4ee709b70 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Sun, 15 Feb 2026 02:36:24 +0100 Subject: [PATCH 27/50] feat(PurchaseCalculator): Add initial tests. --- .../calculator/PurchaseCalculatorTest.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/test/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java b/src/test/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java index c69b00a..94f1fc6 100644 --- a/src/test/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java @@ -1,4 +1,51 @@ package edu.ntnu.idi.idatt.calculator; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.math.BigDecimal; +import java.util.List; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import edu.ntnu.idi.idatt.marked.Share; +import edu.ntnu.idi.idatt.marked.Stock; + class PurchaseCalculatorTest { + + private Stock stock; + private Share share; + private PurchaseCalculator purchaseCalculator; + + @BeforeEach + public void PT_setup() { + // stock instance and parameters + List prices = List.of(BigDecimal.valueOf(46.2), + BigDecimal.valueOf(40.0)); + stock = new Stock("AAPL", "Apple Inc.", prices); + + // Share instance parameters + BigDecimal quantity = BigDecimal.valueOf(3.3); + share = new Share(stock, quantity, stock.getSalesPrice()); + + // PurchaseCalculator instance + purchaseCalculator = new PurchaseCalculator(share); + } + + /** + * + * Since calculateTotal() method is composed of all the other methods in this + * class, + * it will singlehandedly validate the methods of this class. + */ + @Test + void PT_calculationTotal() { + + BigDecimal expected = BigDecimal.valueOf(40.0) + .multiply(BigDecimal.valueOf(3.3)) + .multiply(BigDecimal.valueOf(1.005)); + assertEquals(expected, purchaseCalculator.calculateTotal()); + + } + } From e85d4ae00fa3a43d6f81387ba0d59d78456b62f2 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Sun, 15 Feb 2026 02:37:58 +0100 Subject: [PATCH 28/50] feat(SaleCalculator): Add initial tests and fix corresponding class. --- .../idi/idatt/calculator/SaleCalculator.java | 5 +- .../idatt/calculator/SaleCalculatorTest.java | 75 +++++++++++++++++++ 2 files changed, 78 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java b/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java index 1df1f61..d9dc8f0 100644 --- a/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java +++ b/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java @@ -59,8 +59,9 @@ public BigDecimal calculateCommision() { @Override public BigDecimal calculateTax() { BigDecimal taxPercentage = BigDecimal.valueOf(0.3); // Corresponding to 30% - BigDecimal profit = calculateGross().subtract(purchasePrice.multiply(quantity)); // gross - purchase price x - // quanitity + BigDecimal profit = calculateGross().subtract(purchasePrice.multiply(quantity)) + .subtract(calculateCommision()); // (gross - tax - buy costs) + return profit.multiply(taxPercentage); } diff --git a/src/test/java/edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java b/src/test/java/edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java index 71b9be1..83b46d1 100644 --- a/src/test/java/edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java @@ -1,4 +1,79 @@ package edu.ntnu.idi.idatt.calculator; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.math.BigDecimal; +import java.util.List; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import edu.ntnu.idi.idatt.marked.Share; +import edu.ntnu.idi.idatt.marked.Stock; + class SaleCalculatorTest { + + private Stock stock; + private Share share; + private SaleCalculator saleCalculator; + + @BeforeEach + public void PT_setup() { + // stock instance and parameters + List prices = List.of(BigDecimal.valueOf(46.2), + BigDecimal.valueOf(40.0)); + stock = new Stock("AAPL", "Apple Inc.", prices); + + // Share instance parameters + BigDecimal quantity = BigDecimal.valueOf(3.3); + share = new Share(stock, quantity, stock.getSalesPrice()); + + // PurchaseCalculator instance + saleCalculator = new SaleCalculator(share); + } + + /** + * + * Since calculateTotal() method is composed of all the other methods in this + * class, + * it will singlehandedly validate the methods of this class. + * + * @see SaleCalculator + */ + @Test + void PT_calculationTotal() { + + // For imitation, let's add a new weeks stock price. + stock.addNewSalesPrice(BigDecimal.valueOf(47.8)); + saleCalculator = new SaleCalculator(share); + /** + * Update the SaleCalculator sale price variable. Due to the formulation of the + * task, + * we have to contain the purchasePrice, salesPrice and quantity as fields + * instead of + * accessing them through the share itself (Share holds a final reference to a + * Stock) + * which suggests contineous update of the field. + * + * Since this class is instanced in the constructor of Sale which is again + * itself instanced for each player event, this method is contineously updated + * in a way compared the line over. + * + * @see Exchange + */ + + BigDecimal gross = share.getStock().getSalesPrice().multiply(share.getQuantity()); + BigDecimal commision = gross.multiply(BigDecimal.valueOf(0.01)); + System.out.println(gross); + System.out.println(saleCalculator.calculateGross()); + BigDecimal tax = gross.subtract(commision).subtract( + share.getPurchasePrice() + .multiply(share.getQuantity())) + .multiply(BigDecimal.valueOf(0.3)); + + BigDecimal expected = gross.subtract(commision).subtract(tax); + assertEquals(expected, saleCalculator.calculateTotal()); + + } + } From a497a7541ab3ef02ab4909393e339aee9e6ca665 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Sun, 15 Feb 2026 20:27:23 +0100 Subject: [PATCH 29/50] feat(Purchase): Add initial tests. --- .../idi/idatt/transaction/PurchaseTest.java | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/test/java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java b/src/test/java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java index aeab4fc..1d0bb58 100644 --- a/src/test/java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java @@ -1,4 +1,70 @@ package edu.ntnu.idi.idatt.transaction; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.math.BigDecimal; +import java.util.List; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import edu.ntnu.idi.idatt.Player; +import edu.ntnu.idi.idatt.marked.Share; +import edu.ntnu.idi.idatt.marked.Stock; + +/** + * Testing for Purchase class + * + *

+ * Since this class is meant as an object + * that contains transaction details, we will look away from + * testing commit() method. + * + * commit() contains only method calls upon player, except changing the commited + * boolean field. + * We will only be vaguely testing it for this field. + *

+ */ class PurchaseTest { + + private Stock stock; + private Share share; + private Purchase purchase; + + @BeforeEach + public void PT_setup() { + // stock instance and parameters + List prices = List.of(BigDecimal.valueOf(46.2), + BigDecimal.valueOf(40.0)); + stock = new Stock("AAPL", "Apple Inc.", prices); + + // Share instance and parameters + BigDecimal quantity = BigDecimal.valueOf(3.3); + share = new Share(stock, quantity, stock.getSalesPrice()); + + // Transaction instance + purchase = new Purchase(share, 1); + } + + /** + * + * Since calculateTotal() method is composed of all the other methods in this + * class, + * it will singlehandedly validate the methods of this class. + */ + @Test + void PTconstructorTest() { + + assertEquals(share, purchase.getShare()); + assertEquals(1, purchase.getWeek()); + assertEquals(new BigDecimal("132.00"), purchase.getCalculator().calculateGross()); // Because of none stored + // *Calculator, we test with a existing method we can measure the values of. + assertFalse(purchase.isCommited()); + purchase.commit(new Player("ExamplePlayer", BigDecimal.valueOf(2500))); + assertTrue(purchase.isCommited()); + + } + } From 1c4ce00d3a5e169a5c3e3378f7bfeaeda67fd134 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Sun, 15 Feb 2026 20:28:28 +0100 Subject: [PATCH 30/50] feat(Sale): Add initial tests. --- .../ntnu/idi/idatt/transaction/SaleTest.java | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java b/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java index c69a039..d026a1b 100644 --- a/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java @@ -1,4 +1,70 @@ package edu.ntnu.idi.idatt.transaction; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.math.BigDecimal; +import java.util.List; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import edu.ntnu.idi.idatt.Player; +import edu.ntnu.idi.idatt.marked.Share; +import edu.ntnu.idi.idatt.marked.Stock; + +/** + * Testing for Sale class + * + *

+ * Since this class is meant as an object + * that contains transaction details, we will look away from + * testing commit() method. + * + * commit() contains only method calls upon player, except changing the commited + * boolean field. + * We will only be vaguely testing it for this field. + *

+ */ class SaleTest { + + private Stock stock; + private Share share; + private Sale sale; + + @BeforeEach + public void PT_setup() { + // stock instance and parameters + List prices = List.of(BigDecimal.valueOf(46.2), + BigDecimal.valueOf(40.0)); + stock = new Stock("AAPL", "Apple Inc.", prices); + + // Share instance and parameters + BigDecimal quantity = BigDecimal.valueOf(3.3); + share = new Share(stock, quantity, stock.getSalesPrice()); + + // Transaction instance + sale = new Sale(share, 1); + } + + /** + * + * Since calculateTotal() method is composed of all the other methods in this + * class, + * it will singlehandedly validate the methods of this class. + */ + @Test + void PTconstructorTest() { + + assertEquals(share, sale.getShare()); + assertEquals(1, sale.getWeek()); + assertEquals(new BigDecimal("132.00"), sale.getCalculator().calculateGross()); // Because of none stored + // *Calculator, we test with a existing method we can measure the values of. + assertFalse(sale.isCommited()); + sale.commit(new Player("ExamplePlayer", BigDecimal.valueOf(2500))); + assertTrue(sale.isCommited()); + + } + } From a1facac6b96531ebe4fef5130c37d9755fa62249 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Sun, 15 Feb 2026 20:31:16 +0100 Subject: [PATCH 31/50] chore: Removed redundant test classes. --- .../java/edu/ntnu/idi/idatt/transaction/TransactionTest.java | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 src/test/java/edu/ntnu/idi/idatt/transaction/TransactionTest.java diff --git a/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionTest.java b/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionTest.java deleted file mode 100644 index a1232b0..0000000 --- a/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionTest.java +++ /dev/null @@ -1,4 +0,0 @@ -package edu.ntnu.idi.idatt.transaction; - -class TransactionTest { -} From 553bc00eb8d4a5994784679fec5fd2feee61557c Mon Sep 17 00:00:00 2001 From: pawelsa Date: Sun, 15 Feb 2026 21:46:36 +0100 Subject: [PATCH 32/50] feat(TransactionArchive): Add initial tests and fix corresponding class. --- .../idatt/transaction/TransactionArchive.java | 4 +- .../transaction/TransactionArchiveTest.java | 86 +++++++++++++++++++ 2 files changed, 88 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionArchive.java b/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionArchive.java index c53fa81..0567591 100644 --- a/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionArchive.java +++ b/src/main/java/edu/ntnu/idi/idatt/transaction/TransactionArchive.java @@ -51,7 +51,7 @@ public List getTransactions(int week) { * @return - List of Purchase done in a specified week. */ public List getPurchases(int week) { - return transactions.stream().filter(t -> t instanceof Purchase) + return getTransactions(week).stream().filter(t -> t instanceof Purchase) .map(t -> (Purchase) t) .toList(); } @@ -63,7 +63,7 @@ public List getPurchases(int week) { * @return - List of Sale done in a specified week. */ public List getSales(int week) { - return transactions.stream().filter(t -> t instanceof Sale) + return getTransactions(week).stream().filter(t -> t instanceof Sale) .map(t -> (Sale) t) .toList(); } diff --git a/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionArchiveTest.java b/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionArchiveTest.java index 0ad836e..a7a388f 100644 --- a/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionArchiveTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionArchiveTest.java @@ -1,4 +1,90 @@ package edu.ntnu.idi.idatt.transaction; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.math.BigDecimal; +import java.util.List; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import edu.ntnu.idi.idatt.marked.Share; +import edu.ntnu.idi.idatt.marked.Stock; + class TransactionArchiveTest { + + List transactions; + TransactionArchive transactionArchive; + + @BeforeEach + public void getDefaultValues() { + + Stock AAPL = new Stock("AAPL", "Apple Inc.", List.of(BigDecimal.valueOf(32))); + Stock NVDA = new Stock("NVDA", "NVIDIA", List.of(BigDecimal.valueOf(182.81))); + Stock TSLA = new Stock("TSLA", "Tesla", List.of(BigDecimal.valueOf(417.44))); + Stock AMD = new Stock("AMD", "Advanced Micro Devices", List.of(BigDecimal.valueOf(207.32))); + + Share AAPLShare = new Share(AAPL, BigDecimal.valueOf(1.0), AAPL.getSalesPrice()); + Share NVDAShare = new Share(NVDA, BigDecimal.valueOf(1.0), NVDA.getSalesPrice()); + Share TSLAShare = new Share(TSLA, BigDecimal.valueOf(1.0), TSLA.getSalesPrice()); + Share AMDShare = new Share(AMD, BigDecimal.valueOf(1.0), AMD.getSalesPrice()); + + Purchase purchase1 = new Purchase(AAPLShare, 1); + Purchase purchase2 = new Purchase(AMDShare, 2); + Sale sale1 = new Sale(TSLAShare, 1); + Sale sale2 = new Sale(NVDAShare, 2); + + transactions = List.of(purchase1, purchase2, sale1, sale2); + + transactionArchive = new TransactionArchive(); + transactions.forEach(transaction -> transactionArchive.add(transaction)); + + } + + @Test + void PTaddTransactions() { + TransactionArchive archive = new TransactionArchive(); + + assertTrue(archive.add(transactions.get(0))); + assertEquals(1, archive.getTransactions(1).size()); + assertTrue(archive.add(transactions.get(2))); // Add one more + assertEquals(2, archive.getTransactions(1).size()); + + } + + @Test + void PTisEmpty() { + + TransactionArchive archive = new TransactionArchive(); + + assertTrue(archive.isEmpty()); + archive.add(transactions.get(0)); + assertFalse(archive.isEmpty()); + + } + + /** + * + *

+ * Since we know that the basics of the TransactionArchive works with the + * tests over, we will now move to using the TransactionArchive field made + * from @BeforeEach. + *

+ * + */ + + @Test + void PTgetTransactions() { + + assertEquals(2, transactionArchive.getTransactions(1).size()); // First week all transactions + assertEquals(2, transactionArchive.getTransactions(2).size()); + assertEquals(1, transactionArchive.getPurchases(1).size()); + assertEquals(1, transactionArchive.getSales(1).size()); + assertEquals(1, transactionArchive.getPurchases(2).size()); + assertEquals(1, transactionArchive.getSales(2).size()); + + } + } From 778cb4dd04a92676a1b8e2d58a24fa518024a1b9 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Mon, 16 Feb 2026 00:14:12 +0100 Subject: [PATCH 33/50] feat(Player): Add initial tests. --- .../java/edu/ntnu/idi/idatt/PlayerTest.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/test/java/edu/ntnu/idi/idatt/PlayerTest.java b/src/test/java/edu/ntnu/idi/idatt/PlayerTest.java index d6bab4b..cd6df5d 100644 --- a/src/test/java/edu/ntnu/idi/idatt/PlayerTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/PlayerTest.java @@ -1,4 +1,44 @@ package edu.ntnu.idi.idatt; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.math.BigDecimal; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + class PlayerTest { + + private Player player; + + @BeforeEach + public void PT_setup() { + + player = new Player("TestPlayer", new BigDecimal("500")); + + } + + @Test + void PTConstructor() { + assertEquals("TestPlayer", player.getName()); + assertEquals(new BigDecimal("500"), player.getMoney()); + assertNotNull(player.getPortfolio()); + assertNotNull(player.getTransactionArchive()); + } + + @Test + void PTaddMoney() { + + player.addMoney(new BigDecimal("200")); + assertEquals(new BigDecimal("700"), player.getMoney()); + + } + + @Test + void PTwithdrawMoney() { + player.withdrawMoney(new BigDecimal("200")); + assertEquals(new BigDecimal("300"), player.getMoney()); + } + } From 1cef43723f3854d8bd2ce3c2c5f3ffad47b84ee6 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Mon, 16 Feb 2026 01:03:52 +0100 Subject: [PATCH 34/50] feat(Exchange): Add initial tests and fix corresponding class. --- .../java/edu/ntnu/idi/idatt/Exchange.java | 2 +- .../java/edu/ntnu/idi/idatt/ExchangeTest.java | 136 ++++++++++++++++++ 2 files changed, 137 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/Exchange.java b/src/main/java/edu/ntnu/idi/idatt/Exchange.java index 318b69f..2153bd9 100644 --- a/src/main/java/edu/ntnu/idi/idatt/Exchange.java +++ b/src/main/java/edu/ntnu/idi/idatt/Exchange.java @@ -76,7 +76,7 @@ public boolean hasStock(String symbol) { */ public Stock getStock(String symbol) { if (this.hasStock(symbol)) { - stockMap.get(symbol); + return stockMap.get(symbol); } throw new IllegalArgumentException("This stock doesn't exist in [" + name + "] exchange."); } diff --git a/src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java b/src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java index 153f079..ce14565 100644 --- a/src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java @@ -1,4 +1,140 @@ package edu.ntnu.idi.idatt; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import edu.ntnu.idi.idatt.marked.Stock; +import edu.ntnu.idi.idatt.transaction.Transaction; + class ExchangeTest { + + private Exchange exchange; + private List stocks; + private Player player; + + @BeforeEach + public void PT_setup() { + + // Initialize exchange with proper objects + Stock AAPL = new Stock("AAPL", "Apple Inc.", List.of(BigDecimal.valueOf(32))); + Stock NVDA = new Stock("NVDA", "NVIDIA", List.of(BigDecimal.valueOf(182.81))); + Stock TSLA = new Stock("TSLA", "Tesla", List.of(BigDecimal.valueOf(417.44))); + Stock AMD = new Stock("AMD", "Advanced Micro Devices", List.of(BigDecimal.valueOf(207.32))); + + stocks = List.of(AAPL, NVDA, TSLA, AMD); + + exchange = new Exchange("TestExchange", stocks); + player = new Player("TestPlayer", new BigDecimal("500")); + } + + @Test + void PTConstructor() { + assertEquals("TestExchange", exchange.getName()); + assertEquals(1, exchange.getWeek()); + } + + /** + * Positive tests for stock-related methods. + * + *

+ * Includes hasStock, getStock and findStocks. + *

+ * + */ + + @Test + void PTFindStock() { + + assertTrue(exchange.hasStock("AAPL")); + assertEquals(stocks.get(0) /* AAPL Stock */, exchange.getStock("AAPL")); + + // FindStocks for letter "n" should be - AAPL, AMD (both symbols and names!) + List expected = List.of(stocks.get(0), stocks.get(3)); + // + assertEquals(expected, exchange.findStocks("n")); + + } + + /** + * + *

+ * Since this method includes basically everything this project + * contains we will just check essential things that everything + * worked as it was supposted. + *

+ */ + @Test + void PTBuy() { + + Transaction transaction = exchange.buy("AAPL", new BigDecimal("1"), player); + assertEquals(transaction, player.getTransactionArchive().getTransactions(1).getLast()); + assertEquals(-1, player.getMoney().compareTo(new BigDecimal("500"))); // Less than 500 + assertEquals(1, player.getPortfolio().getShares().size()); + assertEquals("AAPL", player.getPortfolio().getShares().get(0).getStock().getSymbol()); + + } + + /** + * + *

+ * Since this method includes basically everything this project + * contains we will just check essential things that everything + * worked as it was supposted. + *

+ */ + @Test + void PTSell() { + // Player hasa to have a share to sell it. + exchange.buy("AAPL", new BigDecimal("1"), player); + stocks.get(0).addNewSalesPrice(new BigDecimal("40")); // Simulate increase of AAPL stock price + + Transaction transaction = exchange.sell(player.getPortfolio().getShares().getLast(), player); + assertEquals(transaction, player.getTransactionArchive().getTransactions(1).getLast()); + assertEquals(1, player.getMoney().compareTo(new BigDecimal("500"))); // Less than 500 + assertEquals(0, player.getPortfolio().getShares().size()); + + } + + @Test + void PTAdvance() { + List stockPricesBefore = new ArrayList<>(); + for (Stock stock : stocks) { + stockPricesBefore.add(stocks.indexOf(stock), stock.getSalesPrice()); + } + + exchange.advance(); + + for (Stock stock : stocks) { + assertTrue(stockPricesBefore.get(stocks.indexOf(stock)).compareTo(stock.getSalesPrice()) != 0); + // If compareTo returns 0 then its equal. + } + + } + + /** + * Negative tests for stock-related methods. + * + *

+ * Includes hasStock, getStock and findStocks. + *

+ * + */ + @Test + void NTFindStock() { + + assertFalse(exchange.hasStock("Test")); + assertThrows(IllegalArgumentException.class, () -> exchange.getStock("thiswillnotwork")); + assertEquals(List.of() /* Empty list */, exchange.findStocks("X")); + + } + } From 3a6400d945f0f3dc1d11f414a5f46de1b8c85e16 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Mon, 16 Feb 2026 01:27:21 +0100 Subject: [PATCH 35/50] chore(Test classes): cleanup code and some JavaDocs. --- .../java/edu/ntnu/idi/idatt/ExchangeTest.java | 10 +++++----- .../calculator/PurchaseCalculatorTest.java | 12 ++++++------ .../idatt/calculator/SaleCalculatorTest.java | 14 ++++++-------- .../ntnu/idi/idatt/marked/PortfolioTest.java | 6 +++--- .../edu/ntnu/idi/idatt/marked/ShareTest.java | 8 ++++---- .../edu/ntnu/idi/idatt/marked/StockTest.java | 13 ++++++------- .../idi/idatt/transaction/PurchaseTest.java | 13 ++++++++----- .../ntnu/idi/idatt/transaction/SaleTest.java | 15 ++++++++++----- .../transaction/TransactionArchiveTest.java | 18 +++++++++--------- 9 files changed, 57 insertions(+), 52 deletions(-) diff --git a/src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java b/src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java index ce14565..743f3be 100644 --- a/src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/ExchangeTest.java @@ -25,10 +25,10 @@ class ExchangeTest { public void PT_setup() { // Initialize exchange with proper objects - Stock AAPL = new Stock("AAPL", "Apple Inc.", List.of(BigDecimal.valueOf(32))); - Stock NVDA = new Stock("NVDA", "NVIDIA", List.of(BigDecimal.valueOf(182.81))); - Stock TSLA = new Stock("TSLA", "Tesla", List.of(BigDecimal.valueOf(417.44))); - Stock AMD = new Stock("AMD", "Advanced Micro Devices", List.of(BigDecimal.valueOf(207.32))); + Stock AAPL = new Stock("AAPL", "Apple Inc.", List.of(new BigDecimal("32"))); + Stock NVDA = new Stock("NVDA", "NVIDIA", List.of(new BigDecimal("182.81"))); + Stock TSLA = new Stock("TSLA", "Tesla", List.of(new BigDecimal("417.44"))); + Stock AMD = new Stock("AMD", "Advanced Micro Devices", List.of(new BigDecimal("207.32"))); stocks = List.of(AAPL, NVDA, TSLA, AMD); @@ -93,7 +93,7 @@ void PTBuy() { */ @Test void PTSell() { - // Player hasa to have a share to sell it. + // Player has to have a share to sell it. exchange.buy("AAPL", new BigDecimal("1"), player); stocks.get(0).addNewSalesPrice(new BigDecimal("40")); // Simulate increase of AAPL stock price diff --git a/src/test/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java b/src/test/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java index 94f1fc6..5d306c0 100644 --- a/src/test/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculatorTest.java @@ -20,12 +20,12 @@ class PurchaseCalculatorTest { @BeforeEach public void PT_setup() { // stock instance and parameters - List prices = List.of(BigDecimal.valueOf(46.2), - BigDecimal.valueOf(40.0)); + List prices = List.of(new BigDecimal("46.2"), + new BigDecimal("40.0")); stock = new Stock("AAPL", "Apple Inc.", prices); // Share instance parameters - BigDecimal quantity = BigDecimal.valueOf(3.3); + BigDecimal quantity = new BigDecimal("3.3"); share = new Share(stock, quantity, stock.getSalesPrice()); // PurchaseCalculator instance @@ -41,9 +41,9 @@ public void PT_setup() { @Test void PT_calculationTotal() { - BigDecimal expected = BigDecimal.valueOf(40.0) - .multiply(BigDecimal.valueOf(3.3)) - .multiply(BigDecimal.valueOf(1.005)); + BigDecimal expected = new BigDecimal("40.0") + .multiply(new BigDecimal("3.3")) + .multiply(new BigDecimal("1.005")); assertEquals(expected, purchaseCalculator.calculateTotal()); } diff --git a/src/test/java/edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java b/src/test/java/edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java index 83b46d1..3672172 100644 --- a/src/test/java/edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/calculator/SaleCalculatorTest.java @@ -20,12 +20,12 @@ class SaleCalculatorTest { @BeforeEach public void PT_setup() { // stock instance and parameters - List prices = List.of(BigDecimal.valueOf(46.2), - BigDecimal.valueOf(40.0)); + List prices = List.of(new BigDecimal("46.2"), + new BigDecimal("40.0")); stock = new Stock("AAPL", "Apple Inc.", prices); // Share instance parameters - BigDecimal quantity = BigDecimal.valueOf(3.3); + BigDecimal quantity = new BigDecimal("3.3"); share = new Share(stock, quantity, stock.getSalesPrice()); // PurchaseCalculator instance @@ -44,7 +44,7 @@ public void PT_setup() { void PT_calculationTotal() { // For imitation, let's add a new weeks stock price. - stock.addNewSalesPrice(BigDecimal.valueOf(47.8)); + stock.addNewSalesPrice(new BigDecimal("47.8")); saleCalculator = new SaleCalculator(share); /** * Update the SaleCalculator sale price variable. Due to the formulation of the @@ -63,13 +63,11 @@ void PT_calculationTotal() { */ BigDecimal gross = share.getStock().getSalesPrice().multiply(share.getQuantity()); - BigDecimal commision = gross.multiply(BigDecimal.valueOf(0.01)); - System.out.println(gross); - System.out.println(saleCalculator.calculateGross()); + BigDecimal commision = gross.multiply(new BigDecimal("0.01")); BigDecimal tax = gross.subtract(commision).subtract( share.getPurchasePrice() .multiply(share.getQuantity())) - .multiply(BigDecimal.valueOf(0.3)); + .multiply(new BigDecimal("0.3")); BigDecimal expected = gross.subtract(commision).subtract(tax); assertEquals(expected, saleCalculator.calculateTotal()); diff --git a/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java b/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java index 24c22d9..4c26229 100644 --- a/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java @@ -28,12 +28,12 @@ public class PortfolioTest { @BeforeEach public void PT_setup() { // stock instance and parameters - List prices = List.of(BigDecimal.valueOf(46.2), - BigDecimal.valueOf(40.0)); + List prices = List.of(new BigDecimal("46.2"), + new BigDecimal("40.0")); stock = new Stock("AAPL", "Apple Inc.", prices); // Share instance parameters - BigDecimal quantity = BigDecimal.valueOf(3.3); + BigDecimal quantity = new BigDecimal("3.3"); share = new Share(stock, quantity, stock.getSalesPrice()); // Portfolio instance diff --git a/src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java b/src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java index 3af2df2..ac69822 100644 --- a/src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/marked/ShareTest.java @@ -15,12 +15,12 @@ public class ShareTest { @BeforeEach public void PT_setup() { - List prices = List.of(BigDecimal.valueOf(46.2), - BigDecimal.valueOf(40.0)); + List prices = List.of(new BigDecimal("46.2"), + new BigDecimal("40.0")); stock = new Stock("AAPL", "Apple Inc.", prices); // Share parameters - BigDecimal quantity = BigDecimal.valueOf(3.3); + BigDecimal quantity = new BigDecimal("3.3"); share = new Share(stock, quantity, stock.getSalesPrice()); } @@ -29,7 +29,7 @@ public void PT_setup() { void constructorTest() { assertEquals(stock, share.getStock()); - assertEquals(BigDecimal.valueOf(3.3), share.getQuantity()); + assertEquals(new BigDecimal("3.3"), share.getQuantity()); assertEquals(stock.getSalesPrice(), share.getPurchasePrice()); } diff --git a/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java b/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java index ec226c4..330e342 100644 --- a/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java @@ -5,7 +5,6 @@ import java.math.BigDecimal; import java.util.List; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -21,8 +20,8 @@ public class StockTest { @BeforeEach public void PT_setup() { - List prices = List.of(BigDecimal.valueOf(46.2), - BigDecimal.valueOf(40.0)); + List prices = List.of(new BigDecimal("46.2"), + new BigDecimal("40.0")); stock = new Stock("AAPL", "Apple Inc.", prices); } @@ -32,15 +31,15 @@ void constructorTest() { assertEquals("AAPL", stock.getSymbol()); assertEquals("Apple Inc.", stock.getCompany()); - assertEquals(List.of(BigDecimal.valueOf(46.2), - BigDecimal.valueOf(40.0)), stock.getPrices()); + assertEquals(List.of(new BigDecimal("46.2"), + new BigDecimal("40.0")), stock.getPrices()); - assertEquals(BigDecimal.valueOf(40.0), stock.getSalesPrice()); + assertEquals(new BigDecimal("40.0"), stock.getSalesPrice()); } @Test void addNewSalesPriceTest() { - BigDecimal value = BigDecimal.valueOf(15.6); + BigDecimal value = new BigDecimal("15.6"); stock.addNewSalesPrice(value); assertEquals(value, stock.getSalesPrice()); diff --git a/src/test/java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java b/src/test/java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java index 1d0bb58..25f9c9e 100644 --- a/src/test/java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/transaction/PurchaseTest.java @@ -25,7 +25,10 @@ * commit() contains only method calls upon player, except changing the commited * boolean field. * We will only be vaguely testing it for this field. - *

+ * + * @see Exchange + * @see Purchase + *

*/ class PurchaseTest { @@ -36,12 +39,12 @@ class PurchaseTest { @BeforeEach public void PT_setup() { // stock instance and parameters - List prices = List.of(BigDecimal.valueOf(46.2), - BigDecimal.valueOf(40.0)); + List prices = List.of(new BigDecimal("46.2"), + new BigDecimal("40.0")); stock = new Stock("AAPL", "Apple Inc.", prices); // Share instance and parameters - BigDecimal quantity = BigDecimal.valueOf(3.3); + BigDecimal quantity = new BigDecimal("3.3"); share = new Share(stock, quantity, stock.getSalesPrice()); // Transaction instance @@ -62,7 +65,7 @@ void PTconstructorTest() { assertEquals(new BigDecimal("132.00"), purchase.getCalculator().calculateGross()); // Because of none stored // *Calculator, we test with a existing method we can measure the values of. assertFalse(purchase.isCommited()); - purchase.commit(new Player("ExamplePlayer", BigDecimal.valueOf(2500))); + purchase.commit(new Player("ExamplePlayer", new BigDecimal("2500"))); assertTrue(purchase.isCommited()); } diff --git a/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java b/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java index d026a1b..4a0482a 100644 --- a/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java @@ -10,6 +10,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import edu.ntnu.idi.idatt.Exchange; import edu.ntnu.idi.idatt.Player; import edu.ntnu.idi.idatt.marked.Share; import edu.ntnu.idi.idatt.marked.Stock; @@ -25,7 +26,11 @@ * commit() contains only method calls upon player, except changing the commited * boolean field. * We will only be vaguely testing it for this field. - *

+ * + * @see Exchange + * @see Sale + * + *

*/ class SaleTest { @@ -36,12 +41,12 @@ class SaleTest { @BeforeEach public void PT_setup() { // stock instance and parameters - List prices = List.of(BigDecimal.valueOf(46.2), - BigDecimal.valueOf(40.0)); + List prices = List.of(new BigDecimal("46.2"), + new BigDecimal("40.0")); stock = new Stock("AAPL", "Apple Inc.", prices); // Share instance and parameters - BigDecimal quantity = BigDecimal.valueOf(3.3); + BigDecimal quantity = new BigDecimal("3.3"); share = new Share(stock, quantity, stock.getSalesPrice()); // Transaction instance @@ -62,7 +67,7 @@ void PTconstructorTest() { assertEquals(new BigDecimal("132.00"), sale.getCalculator().calculateGross()); // Because of none stored // *Calculator, we test with a existing method we can measure the values of. assertFalse(sale.isCommited()); - sale.commit(new Player("ExamplePlayer", BigDecimal.valueOf(2500))); + sale.commit(new Player("ExamplePlayer", new BigDecimal("2500"))); assertTrue(sale.isCommited()); } diff --git a/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionArchiveTest.java b/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionArchiveTest.java index a7a388f..482a45c 100644 --- a/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionArchiveTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/transaction/TransactionArchiveTest.java @@ -21,15 +21,15 @@ class TransactionArchiveTest { @BeforeEach public void getDefaultValues() { - Stock AAPL = new Stock("AAPL", "Apple Inc.", List.of(BigDecimal.valueOf(32))); - Stock NVDA = new Stock("NVDA", "NVIDIA", List.of(BigDecimal.valueOf(182.81))); - Stock TSLA = new Stock("TSLA", "Tesla", List.of(BigDecimal.valueOf(417.44))); - Stock AMD = new Stock("AMD", "Advanced Micro Devices", List.of(BigDecimal.valueOf(207.32))); - - Share AAPLShare = new Share(AAPL, BigDecimal.valueOf(1.0), AAPL.getSalesPrice()); - Share NVDAShare = new Share(NVDA, BigDecimal.valueOf(1.0), NVDA.getSalesPrice()); - Share TSLAShare = new Share(TSLA, BigDecimal.valueOf(1.0), TSLA.getSalesPrice()); - Share AMDShare = new Share(AMD, BigDecimal.valueOf(1.0), AMD.getSalesPrice()); + Stock AAPL = new Stock("AAPL", "Apple Inc.", List.of(new BigDecimal("32"))); + Stock NVDA = new Stock("NVDA", "NVIDIA", List.of(new BigDecimal("182.81"))); + Stock TSLA = new Stock("TSLA", "Tesla", List.of(new BigDecimal("417.44"))); + Stock AMD = new Stock("AMD", "Advanced Micro Devices", List.of(new BigDecimal("207.32"))); + + Share AAPLShare = new Share(AAPL, new BigDecimal("1.0"), AAPL.getSalesPrice()); + Share NVDAShare = new Share(NVDA, new BigDecimal("1.0"), NVDA.getSalesPrice()); + Share TSLAShare = new Share(TSLA, new BigDecimal("1.0"), TSLA.getSalesPrice()); + Share AMDShare = new Share(AMD, new BigDecimal("1.0"), AMD.getSalesPrice()); Purchase purchase1 = new Purchase(AAPLShare, 1); Purchase purchase2 = new Purchase(AMDShare, 2); From 1ed22c0f738585aacff9fa5a53ba0420258b63ab Mon Sep 17 00:00:00 2001 From: pawelsa Date: Mon, 16 Feb 2026 01:51:27 +0100 Subject: [PATCH 36/50] feat(Portfolio): Add exception. --- src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java | 3 +++ .../java/edu/ntnu/idi/idatt/marked/PortfolioTest.java | 7 +++++++ .../java/edu/ntnu/idi/idatt/transaction/SaleTest.java | 8 +++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java b/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java index e1385e2..5b4a147 100644 --- a/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java +++ b/src/main/java/edu/ntnu/idi/idatt/marked/Portfolio.java @@ -33,6 +33,9 @@ public boolean addShare(Share share) { * @return - was the list modified? */ public boolean removeShare(Share share) { + if (!contains(share)) { + throw new IllegalArgumentException("Portfolio doesn't contain this share."); + } return shares.remove(share); } diff --git a/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java b/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java index 4c26229..42fd1fd 100644 --- a/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import java.math.BigDecimal; @@ -80,4 +81,10 @@ void PTContains() { assertTrue(portfolio.contains(share)); } + @Test + void NTremoveShare() { + Share exception = new Share(stock, new BigDecimal("2.3"), stock.getSalesPrice()); + assertThrows(IllegalArgumentException.class, () -> portfolio.removeShare(exception)); + } + } diff --git a/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java b/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java index 4a0482a..2f5523b 100644 --- a/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/transaction/SaleTest.java @@ -36,6 +36,7 @@ class SaleTest { private Stock stock; private Share share; + private Player player; private Sale sale; @BeforeEach @@ -49,6 +50,11 @@ public void PT_setup() { BigDecimal quantity = new BigDecimal("3.3"); share = new Share(stock, quantity, stock.getSalesPrice()); + // Player instance and parameters. + // We need a portfolio that has the share already to not throw an exception. + player = new Player("ExamplePlayer", new BigDecimal("500")); + player.getPortfolio().addShare(share); + // Transaction instance sale = new Sale(share, 1); } @@ -67,7 +73,7 @@ void PTconstructorTest() { assertEquals(new BigDecimal("132.00"), sale.getCalculator().calculateGross()); // Because of none stored // *Calculator, we test with a existing method we can measure the values of. assertFalse(sale.isCommited()); - sale.commit(new Player("ExamplePlayer", new BigDecimal("2500"))); + sale.commit(player); assertTrue(sale.isCommited()); } From b2fb41ece8b3f15c0c96d165152d41071c074e73 Mon Sep 17 00:00:00 2001 From: pawelsa Date: Mon, 16 Feb 2026 01:58:19 +0100 Subject: [PATCH 37/50] refactor: README.md about tests. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index fc165a2..b16466c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,12 @@ # Mappevurdering-IDATT2003 + The exam of IDATT2003, "Programming 2" subject. + +# Guide to tests + +- The test generally start with a @BeforeEach method that sets up everything necessary for positive testing. +- Then there comes a positive test section and at last the negative tests. +- Complicated test methods have necessary JavaDocs and often have references pointing to other classes that share content or hold relevant information. +- Dictionary + - **PT** - Positive tests + - **NT** - Negative tests From a0fb680e2054ea34893d5674690b088072bcf7d3 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 17 Feb 2026 19:33:43 +0100 Subject: [PATCH 38/50] feat(gui): Added some more dependencies for javafx in the pom file --- .idea/misc.xml | 2 +- pom.xml | 23 ++++++++++++++++++ .../java/edu/ntnu/idi/idatt/gui/javafx.java | 23 ++++++++++++++++++ src/resources/edu.ntnu.idi.idatt/stonks.jpg | Bin 0 -> 20446 bytes 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/main/java/edu/ntnu/idi/idatt/gui/javafx.java create mode 100644 src/resources/edu.ntnu.idi.idatt/stonks.jpg diff --git a/.idea/misc.xml b/.idea/misc.xml index cdf8ef1..4878ef2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 1cf199e..1ee1c8b 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,29 @@ 25.0.1 + + org.openjfx + javafx-fxml + 25.0.1 + + + + org.openjfx + javafx-web + 25.0.1 + + + + org.openjfx + javafx-swing + 25.0.1 + + + + org.openjfx + javafx-media + 25.0.1 + diff --git a/src/main/java/edu/ntnu/idi/idatt/gui/javafx.java b/src/main/java/edu/ntnu/idi/idatt/gui/javafx.java new file mode 100644 index 0000000..3c7b52c --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt/gui/javafx.java @@ -0,0 +1,23 @@ +package edu.ntnu.idi.idatt.gui; + +import javafx.application.Application; +import javafx.scene.Group; +import javafx.scene.Scene; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.stage.Stage; + +import java.io.FileInputStream; +import java.io.IOException; + +public class javafx extends Application { + @Override + public void start (Stage stage) throws IOException { + FileInputStream stonk = new FileInputStream(getClass().getResourceAsStream("stonks.jpg").toString()); + ImageView stonks = new ImageView(new Image(stonk)); + Group noe = new Group(stonks); + Scene scene1 = new Scene(noe, 500, 500); + stage.setScene(scene1); + stage.show(); + } +} diff --git a/src/resources/edu.ntnu.idi.idatt/stonks.jpg b/src/resources/edu.ntnu.idi.idatt/stonks.jpg new file mode 100644 index 0000000000000000000000000000000000000000..db95b505858f8846550a030b1044a26ce0a9124d GIT binary patch literal 20446 zcmb4qRa6^H6KE(-kpjWp9SQ}C6}N<90fIXe0tEL$arm&{Qrvp52F?-I+P_Fta23clqxY;1yUIqzphq0|3ze4Zz<&fHzw1F4ndl9=0}& z@_vlA@|J##J}^&vMiAW6&Q{&h4rcAh%jhr2FUbFzpD`dnUC8q98b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vuVb#Hsq1Wv=YAE}W%d&-cVA}RjI1a`d2F_N@a&=a z(b;UaTLhpUmCU{~)4kQc4yKw=)UCEhlku$kB)c2xX5hk_SmoeHtzuH}4StUHonVPR z$t$%Oainpf%x*E#zc#Ws-T?9yXH9puJoZ)9Y1IoXo%CkAT zxHExUBQS&{5INPfR6J(j@FOkZG#wVpDYQ>~Xf5_Z7JPm!ywZx`USwR~8`Z;ZSsf&!4O zl#|Gc-cxttpTjdw7;SwC?Kc6nDYG$XP&x0mX!W%*kLu^JeR3#nr?)j8Qu{J?!3W6n zp%9i*anA;ssi$vUGR08bvy-e^8YM%seTDiix+b4Wlv07nZb+^_r2E-f<}0e&6k3MY z4>t!9Kj~cC>-E>W?6F#Vw&ZguTZkiofzp-Vx7@6iq#8bAmMNdr17PQyd^*!^C~#yMI=}oxm!yzn+r(6-(n9!4@2insD{Z_cz3OBG?b))%NU`s zTf`dPv77?*E(j-8U3tcR2b_kjfb^HfdLn#yVmU!)j}m26cSC`!IXMOde&;vqnj z`BoDRpsqviqw5Noi(=CX5|<(JItrrEwd2I%kJ2WgP0!a9WodUMlfk*B<@dAPg6{;GTM10Ryhmc9ndOhQii!7|JguD B=uiLv literal 0 HcmV?d00001 From 3b64b8ef48c235ebe1dc3eac212f65e3a7220992 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 17 Feb 2026 20:33:26 +0100 Subject: [PATCH 39/50] feat(gui): Added picture and a starting scene --- pom.xml | 2 +- src/main/java/edu/ntnu/idi/idatt/gui/javafx.java | 5 +++-- .../resources/edu.ntnu.idi.idatt/stonks.png} | Bin 3 files changed, 4 insertions(+), 3 deletions(-) rename src/{resources/edu.ntnu.idi.idatt/stonks.jpg => main/resources/edu.ntnu.idi.idatt/stonks.png} (100%) diff --git a/pom.xml b/pom.xml index 1ee1c8b..695f58c 100644 --- a/pom.xml +++ b/pom.xml @@ -74,7 +74,7 @@ javafx-maven-plugin 0.0.8 - edu.ntnu.idi.idatt.Main + edu.ntnu.idi.idatt.gui.javafx diff --git a/src/main/java/edu/ntnu/idi/idatt/gui/javafx.java b/src/main/java/edu/ntnu/idi/idatt/gui/javafx.java index 3c7b52c..b2574c0 100644 --- a/src/main/java/edu/ntnu/idi/idatt/gui/javafx.java +++ b/src/main/java/edu/ntnu/idi/idatt/gui/javafx.java @@ -9,12 +9,13 @@ import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStream; public class javafx extends Application { @Override public void start (Stage stage) throws IOException { - FileInputStream stonk = new FileInputStream(getClass().getResourceAsStream("stonks.jpg").toString()); - ImageView stonks = new ImageView(new Image(stonk)); + Image stonk = new Image(getClass().getResource("/edu.ntnu.idi.idatt/stonks.png").toExternalForm()); + ImageView stonks = new ImageView(stonk); Group noe = new Group(stonks); Scene scene1 = new Scene(noe, 500, 500); stage.setScene(scene1); diff --git a/src/resources/edu.ntnu.idi.idatt/stonks.jpg b/src/main/resources/edu.ntnu.idi.idatt/stonks.png similarity index 100% rename from src/resources/edu.ntnu.idi.idatt/stonks.jpg rename to src/main/resources/edu.ntnu.idi.idatt/stonks.png From 56b78f725d5fc6401ae4d0f08ee3ed5ac4d91fa0 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 17 Feb 2026 22:11:02 +0100 Subject: [PATCH 40/50] feat(gui): Added buttons to first and second scene --- .../java/edu/ntnu/idi/idatt/gui/javafx.java | 28 +++++++++++++++--- .../resources/edu.ntnu.idi.idatt/logo.png | Bin 0 -> 8691 bytes .../resources/edu.ntnu.idi.idatt/user.png | Bin 0 -> 10770 bytes 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/edu.ntnu.idi.idatt/logo.png create mode 100644 src/main/resources/edu.ntnu.idi.idatt/user.png diff --git a/src/main/java/edu/ntnu/idi/idatt/gui/javafx.java b/src/main/java/edu/ntnu/idi/idatt/gui/javafx.java index b2574c0..2e29e2f 100644 --- a/src/main/java/edu/ntnu/idi/idatt/gui/javafx.java +++ b/src/main/java/edu/ntnu/idi/idatt/gui/javafx.java @@ -3,21 +3,41 @@ import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; +import javafx.scene.control.Button; import javafx.scene.image.Image; import javafx.scene.image.ImageView; +import javafx.scene.paint.Color; import javafx.stage.Stage; -import java.io.FileInputStream; +import java.awt.*; import java.io.IOException; -import java.io.InputStream; public class javafx extends Application { @Override public void start (Stage stage) throws IOException { Image stonk = new Image(getClass().getResource("/edu.ntnu.idi.idatt/stonks.png").toExternalForm()); + Button week = new Button("Week 5: Play"); + week.setPrefSize(150, 50); + week.setTranslateX(565); + Button logo = new Button(); + Button user = new Button(); + ImageView user_image = new ImageView(new Image(getClass().getResource("/edu.ntnu.idi.idatt/user.png").toExternalForm())); + ImageView logo_image = new ImageView(new Image(getClass().getResource("/edu.ntnu.idi.idatt/logo.png").toExternalForm())); + logo_image.setFitHeight(100); + logo_image.setFitWidth(100); + user_image.setFitHeight(100); + user_image.setFitWidth(100); + logo.setGraphic(logo_image); + user.setGraphic(user_image); + user.setTranslateX(1170); ImageView stonks = new ImageView(stonk); - Group noe = new Group(stonks); - Scene scene1 = new Scene(noe, 500, 500); + stonks.setX(440); + stonks.setY(220); + Group noe = new Group(stonks, week, logo, user); + Scene scene1 = new Scene(noe, 1280, 720, Color.DEEPSKYBLUE); + logo.setOnAction(e -> stage.setScene(new Scene(new Group(stonks,week,logo,user),1280, 720, Color.DEEPSKYBLUE))); + user.setOnAction(e -> stage.setScene(new Scene(new Group(logo,user),1280, 720, Color.BLACK))); + week.setOnAction(e -> stage.close()); stage.setScene(scene1); stage.show(); } diff --git a/src/main/resources/edu.ntnu.idi.idatt/logo.png b/src/main/resources/edu.ntnu.idi.idatt/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..a8980fec7e9c88a498d5e8fee87243cacc770dd5 GIT binary patch literal 8691 zcmeHLc{r3^|G#IkWF1K;!pJt3F_vQN*;2?(>cJR;2{X)$ovejy5oJrZvWMbPAxo%G zs3?-Cq!d}AsQBHZ^49x!uIu-EfA62qxvsh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i<8!nO$G;i`KYA__dJ=MY(X0xIqID6E{bOjy?b;Ve)VXE%mSR6E@mefPFzJ0 z6y%c(SVmR2$8=imnS=mW>g1*l5ADJsIAH?E03=GJ%!mj0Y%lu>Q?~}v z?@br9_l`dXxN-~*%#F)O?dIjI4WiIWD`|%$q(I%9^LJp_Pz&fbd)?PpOsOf0o!-{u zMnLW(L{WU`H_fP{xspiJ~va$ch1(pOQ`=Rm!UU{OVO*90jo;LHaGSa~_x9*0^D z1?zJQaOEyO@I6Vzs0(+fnfc|3B#6Rt*O=qp!_8N!%9<;*?3AAWF0Do zVP~h9l82cVR z?vg6fZAVdlEyKhh`cd~AITf6@QsGJ3#7p3<4om}hv=rM?WoR51qbp&Fz;>pR5l(pd zG*!jjE?m+Q3ke7VQ{t!hu~d%VsY! zDnQ(d6lF(}Z#{-lV6I@wNKvlyo;AdFsEI`JEgc!Df^lM7wa#P>xz;45pd{?x-r1BH mRt~{Q{Ga+B5rw|HZ*W_Rp>~W!c?N#J380LvjOs4C-}!&!T~Ou# literal 0 HcmV?d00001 From 27f5b4a02bd0114ee637537ff273407bae70236e Mon Sep 17 00:00:00 2001 From: PawelSapula Date: Wed, 18 Feb 2026 13:00:32 +0100 Subject: [PATCH 41/50] chore: Cleanup.i --- .../ntnu/idi/idatt/calculator/PurchaseCalculator.java | 2 +- .../edu/ntnu/idi/idatt/calculator/SaleCalculator.java | 4 ++-- .../java/edu/ntnu/idi/idatt/marked/PortfolioTest.java | 9 --------- src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java | 6 ------ 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/main/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculator.java b/src/main/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculator.java index 33ea3c9..fd7847f 100644 --- a/src/main/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculator.java +++ b/src/main/java/edu/ntnu/idi/idatt/calculator/PurchaseCalculator.java @@ -45,7 +45,7 @@ public BigDecimal calculateGross() { */ @Override public BigDecimal calculateCommision() { - BigDecimal fee = BigDecimal.valueOf(0.005); // Corresponding to 0.5% + BigDecimal fee = new BigDecimal("0.005"); // Corresponding to 0.5% return calculateGross().multiply(fee); } diff --git a/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java b/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java index d9dc8f0..6c65302 100644 --- a/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java +++ b/src/main/java/edu/ntnu/idi/idatt/calculator/SaleCalculator.java @@ -47,7 +47,7 @@ public BigDecimal calculateGross() { */ @Override public BigDecimal calculateCommision() { - BigDecimal fee = BigDecimal.valueOf(0.01); // Corresponding to 1% + BigDecimal fee = new BigDecimal("0.01"); // Corresponding to 1% return calculateGross().multiply(fee); } @@ -58,7 +58,7 @@ public BigDecimal calculateCommision() { */ @Override public BigDecimal calculateTax() { - BigDecimal taxPercentage = BigDecimal.valueOf(0.3); // Corresponding to 30% + BigDecimal taxPercentage = new BigDecimal("0.3"); // Corresponding to 30% BigDecimal profit = calculateGross().subtract(purchasePrice.multiply(quantity)) .subtract(calculateCommision()); // (gross - tax - buy costs) diff --git a/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java b/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java index 42fd1fd..f0d0913 100644 --- a/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/marked/PortfolioTest.java @@ -11,15 +11,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -/** - * Test for Portfolio class - * - *

- * Tests done linearly with @BeforeAll, checking - * if functionality works as a whole, - *

- */ - public class PortfolioTest { private Stock stock; diff --git a/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java b/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java index 330e342..7d81482 100644 --- a/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java +++ b/src/test/java/edu/ntnu/idi/idatt/marked/StockTest.java @@ -8,12 +8,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -/** - * Alias definitions - * PT - Positive test/s - * - */ - public class StockTest { private Stock stock; From a79cd61aaf804adedf6e80fef061e5c377c5a0fc Mon Sep 17 00:00:00 2001 From: pawelsa Date: Wed, 18 Feb 2026 13:28:43 +0100 Subject: [PATCH 42/50] fix: pom.xml after merge conflict --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f963052..bff6a52 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ junit-jupiter 6.0.1 test - From 0723ae2be9593beb5432aac86064f1eba5ea82a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Skj=C3=B8rtorp?= Date: Wed, 18 Feb 2026 13:58:49 +0100 Subject: [PATCH 43/50] Create maven.yml --- .github/workflows/maven.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/maven.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..4f1ff73 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,20 @@ +name: Java CI with Maven + +on: + push: + branches: [ "dev" ] + pull_request: + branches: [ "dev" ] + +jobs: + build: + runs-on: self-hosted + + steps: + - uses: actions/checkout@v5 + - name: Set up JDK 25 + uses: actions/setup-java@v4 + - name: Build with Maven + run: mvn clean compile + - name: Test with Maven + run: mvn clean test From 62941a2483ad22ae00a868e631c6a0583f4c2783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Skj=C3=B8rtorp?= Date: Wed, 18 Feb 2026 14:08:30 +0100 Subject: [PATCH 44/50] Update maven.yml --- .github/workflows/maven.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 4f1ff73..cc9f4f9 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -11,7 +11,6 @@ jobs: runs-on: self-hosted steps: - - uses: actions/checkout@v5 - name: Set up JDK 25 uses: actions/setup-java@v4 - name: Build with Maven From 42215b5c52e77c65cc28bffb20bd412a63889ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Skj=C3=B8rtorp?= Date: Wed, 18 Feb 2026 14:10:13 +0100 Subject: [PATCH 45/50] Update maven.yml --- .github/workflows/maven.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index cc9f4f9..028e084 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -11,8 +11,6 @@ jobs: runs-on: self-hosted steps: - - name: Set up JDK 25 - uses: actions/setup-java@v4 - name: Build with Maven run: mvn clean compile - name: Test with Maven From 653ab9e94a352ba0f13baad2310ad815a6ba022f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Skj=C3=B8rtorp?= Date: Wed, 18 Feb 2026 14:13:35 +0100 Subject: [PATCH 46/50] Update maven.yml --- .github/workflows/maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 028e084..fa0d2ac 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -12,6 +12,6 @@ jobs: steps: - name: Build with Maven - run: mvn clean compile + run: mvn clean compile --file pom.xm - name: Test with Maven - run: mvn clean test + run: mvn clean test --file pom.xm From b4db772d06e45c6ab055c6297ce9f12d3dcfee34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Skj=C3=B8rtorp?= Date: Wed, 18 Feb 2026 14:15:39 +0100 Subject: [PATCH 47/50] Update maven.yml --- .github/workflows/maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index fa0d2ac..7a54785 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -12,6 +12,6 @@ jobs: steps: - name: Build with Maven - run: mvn clean compile --file pom.xm + run: mvn clean compile --file pom.xml - name: Test with Maven - run: mvn clean test --file pom.xm + run: mvn clean test --file pom.xml From 8c3e1f52af19d52986dda2f8bcf27fafb64a4158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Skj=C3=B8rtorp?= Date: Wed, 18 Feb 2026 14:18:48 +0100 Subject: [PATCH 48/50] Update maven.yml --- .github/workflows/maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 7a54785..09d0565 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -12,6 +12,6 @@ jobs: steps: - name: Build with Maven - run: mvn clean compile --file pom.xml + run: mvn clean compile --pom.xml - name: Test with Maven - run: mvn clean test --file pom.xml + run: mvn clean test --pom.xml From c9029c91115dd563a894c384fa1afe6bbec1c256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Skj=C3=B8rtorp?= Date: Wed, 18 Feb 2026 14:27:49 +0100 Subject: [PATCH 49/50] Update maven.yml --- .github/workflows/maven.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 09d0565..1bffbd0 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -9,9 +9,19 @@ on: jobs: build: runs-on: self-hosted - + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 25 + uses: actions/setup-java@v5 + with: + java-version: '25' + distribution: 'temurin' + cache: 'maven' + - name: Build with Maven - run: mvn clean compile --pom.xml + run: mvn -B compile --file pom.xml + - name: Test with Maven - run: mvn clean test --pom.xml + run: mvn -B test --file pom.xml + From 18d72fdae5d858a893e329b4fd20df575cc04053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Skj=C3=B8rtorp?= Date: Wed, 18 Feb 2026 14:28:57 +0100 Subject: [PATCH 50/50] Update maven.yml --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 1bffbd0..71d6ce6 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up JDK 25 - uses: actions/setup-java@v5 + uses: actions/setup-java@v4 with: java-version: '25' distribution: 'temurin'