mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-09-27 06:03:19 +02:00
Add a test for price checking
This commit is contained in:
parent
e18269a7b7
commit
467cd34316
@ -0,0 +1,44 @@
|
|||||||
|
package com.Acrobot.ChestShop.Tests;
|
||||||
|
|
||||||
|
import com.Acrobot.ChestShop.Events.PreShopCreationEvent;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.JUnit4;
|
||||||
|
|
||||||
|
import static com.Acrobot.ChestShop.Listeners.PreShopCreation.PriceChecker.onPreShopCreation;
|
||||||
|
import static junit.framework.Assert.assertFalse;
|
||||||
|
import static junit.framework.Assert.assertTrue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Andrzej Pomirski (Acrobot)
|
||||||
|
*/
|
||||||
|
@RunWith(JUnit4.class)
|
||||||
|
public class PriceCheckerTest {
|
||||||
|
|
||||||
|
String[] getPriceString(String prices) {
|
||||||
|
return new String[]{null, null, prices, null};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPrice() {
|
||||||
|
PreShopCreationEvent event = new PreShopCreationEvent(null, null, getPriceString("B 1"));
|
||||||
|
onPreShopCreation(event);
|
||||||
|
assertFalse(event.isCancelled());
|
||||||
|
|
||||||
|
event = new PreShopCreationEvent(null, null, getPriceString("S 1"));
|
||||||
|
onPreShopCreation(event);
|
||||||
|
assertFalse(event.isCancelled());
|
||||||
|
|
||||||
|
event = new PreShopCreationEvent(null, null, getPriceString("B 1:S 1"));
|
||||||
|
onPreShopCreation(event);
|
||||||
|
assertFalse(event.isCancelled());
|
||||||
|
|
||||||
|
event = new PreShopCreationEvent(null, null, getPriceString("BS 1"));
|
||||||
|
onPreShopCreation(event);
|
||||||
|
assertTrue(event.isCancelled());
|
||||||
|
|
||||||
|
event = new PreShopCreationEvent(null, null, getPriceString("B 1S0"));
|
||||||
|
onPreShopCreation(event);
|
||||||
|
assertTrue(event.isCancelled());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user