You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.2 KiB
52 lines
1.2 KiB
/**
|
|
* Copyright (C) 2022, Tim Holloway
|
|
*
|
|
* Date written: Jan 12, 2022
|
|
* Author: Tim Holloway <timh@mousetech.com>
|
|
*/
|
|
package com.mousetech.gourmetj;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import org.junit.jupiter.api.BeforeAll;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import com.mousetech.gourmetj.ShopIngredient;
|
|
import com.mousetech.gourmetj.persistence.model.Shopcat;
|
|
|
|
/**
|
|
* @author timh
|
|
* @since Jan 12, 2022
|
|
*/
|
|
class ShoppingListBeanTest {
|
|
|
|
static List<ShopIngredient> testList;
|
|
|
|
/**
|
|
* @throws java.lang.Exception
|
|
*/
|
|
@BeforeAll
|
|
static void setUpBeforeClass() throws Exception {
|
|
testList = new ArrayList<ShopIngredient>();
|
|
testList.add(new ShopIngredient(2.0d, "cup",
|
|
"sugar", "sugar", "baking"));
|
|
testList.add(new ShopIngredient(1.5, "tsp",
|
|
"salt", "salt", "condiments"));
|
|
testList.add(new ShopIngredient(0.5, "tsp",
|
|
"pepper", "pepper", "condiments"));
|
|
testList.add(new ShopIngredient(2.0d, "cup",
|
|
"milk", "milk", "dairy"));
|
|
testList.add(new ShopIngredient(0.75d, "cup",
|
|
"sugar", "sugar", "baking"));
|
|
}
|
|
|
|
@Test
|
|
void test() {
|
|
ShoppingListBean.optimizeIngredients(testList);
|
|
assertEquals(4, testList.size());
|
|
}
|
|
|
|
}
|
|
|