Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test framework set up. run with 'gradle test'. TODOs in Stock.java #51

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
build

# Ignore class files
.class
**.class

Binary file removed app/bin/main/stock/App.class
Binary file not shown.
Binary file removed app/bin/main/stock/controller/Algorithm.class
Binary file not shown.
Binary file removed app/bin/main/stock/controller/EventRoller.class
Binary file not shown.
Binary file removed app/bin/main/stock/model/Market.class
Binary file not shown.
Binary file removed app/bin/main/stock/model/Stock.class
Binary file not shown.
Binary file removed app/bin/main/stock/model/User.class
Binary file not shown.
Binary file removed app/bin/main/stock/view/mainUI.class
Binary file not shown.
Binary file removed app/bin/test/stock/market/simulator/AppTest.class
Binary file not shown.
6 changes: 4 additions & 2 deletions app/src/main/java/stock/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ public void decreaseStress(int value){
}

public void sellStock(Stock ticker){
stocks.remove(ticker);
// TODO: commented out temporarily to facilitate testing
// stocks.remove(ticker);
}

public void buyStock(Stock ticker){
stocks.add(ticker);
// TODO: commented out temporarily to facilitate testing
// stocks.add(ticker);
}
}
9 changes: 9 additions & 0 deletions app/src/test/java/stock/market/simulator/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.junit.Test;
import stock.App;
import stock.model.Stock;

import static org.junit.Assert.*;

Expand All @@ -13,4 +14,12 @@ public class AppTest {
App classUnderTest = new App();
assertNotNull("app should have a greeting", classUnderTest.getGreeting());
}

@Test public void stock_init() {
Stock test_stock = new Stock("A", "pharma", 1, 100);
assertTrue(test_stock.get_name() == "A");
assertTrue(test_stock.get_type() == "pharma");
assertTrue(test_stock.get_id() == 1);
assertTrue(test_stock.get_price() == 100);
}
}