Commit e62cf698 authored by Karel Frajták's avatar Karel Frajták
Browse files

restart

parent 1a23f7e3
Pipeline #3723 passed with stage
in 45 seconds
......@@ -6,12 +6,15 @@
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.10.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
<type>jar</type>
</dependency>
</dependencies>
<properties>
......@@ -56,7 +59,7 @@
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
......
......@@ -6,6 +6,7 @@ import cz.cvut.eshop.shop.StandardItem;
import java.util.Date;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.assertj.core.api.Assertions.*;
public class LoyaltyPointsTest {
......@@ -24,7 +25,8 @@ public class LoyaltyPointsTest {
order.setCustomer(customer);
order.create();
// assert
assertEquals(10, customer.getLoyaltyPoints());
//assertEquals(10, customer.getLoyaltyPoints());
assertThat(customer.getLoyaltyPoints()).isEqualTo(10);
}
// For certain number of loyalty points the customer gets a discount for one
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import cz.cvut.eshop.shop.Order;
import cz.cvut.eshop.shop.ShoppingCart;
import cz.cvut.eshop.shop.StandardItem;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Karel
*/
public class OrderTest {
@Test
public void createOrderWithCustomerNotSetTest() {
// setup
ShoppingCart cart = new ShoppingCart();
Order order = new Order(cart);
// act
order.create();
// assert
}
@Test
public void orderStateIsUnchanged() {
// setup
ShoppingCart cart = new ShoppingCart();
Order order = new Order(cart, 10);
// act
assertEquals(10, order.getState());
}
@Test
public void itemsPassedCanBeRead() {
// setup
ShoppingCart cart = new ShoppingCart();
cart.addItem(new StandardItem(0, "", 0, "", 0));
Order order = new Order(cart, 0);
// act
// assert
assertEquals(1, order.getItems().size());
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import cz.cvut.eshop.archive.PurchasesArchive;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Karel
*/
public class PurchasesArchiveTest {
@Test
public void itemWasSoldOnce() {
PurchasesArchive archive = new PurchasesArchive();
assertNotNull(archive);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment