Skip to content

Commit

Permalink
Renamed TestMerchant to better fit in with coding conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin Li committed Feb 3, 2015
1 parent 1b37cbd commit cd697e5
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions MerchantRPGCSE2102/src/tests/TestMerchant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package tests;

import game.Merchant;
import junit.framework.TestCase;


public class TestMerchant extends TestCase
{
private Merchant m;

public void setup()
{
m = new Merchant("Test", 100, 2);
}

//testing cash system
public void testCashSystem() throws Exception
{
setup();
assertEquals(-1, m.decrementCash(101));
m.incrementCash(100);
m.refreshCash();
assertEquals(200, m.getCurrentCash());
m.decrementCash(120);
assertEquals(80, m.getCurrentCash());
}

//testing randomizer
public void testRandomizer() throws Exception
{
setup();
boolean testCheck = false;
m.setDailyRandomPrice(10, 50);

if(10 <= m.getRandomPrice() && 50 >= m.getRandomPrice())
{
testCheck = true;
}

assertEquals(true, testCheck);
}

//testing inventory
public void testInventory() throws Exception
{
setup();
assertEquals(2, m.getInventory().length);
}

//testing name
public void testName() throws Exception
{
setup();
assertEquals("Test", m.getName());
}
}

0 comments on commit cd697e5

Please sign in to comment.