package org.xmx0632.deliciousfruit.api.v1.helper;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class CategoryToClientTest {
@Test
public void testFormatCategoryID() {
String formatedID = CategoryToClient.formatCategoryID(3);
assertEquals("C000003", formatedID);
}
@Test
public void testFormatSubCategoryID() {
String formatedID = CategoryToClient.formatSubCategoryID(1101);
assertEquals("S001101", formatedID);
}
@Test
public void testIsCategory() {
assertEquals(true, CategoryToClient.isCategory("C000003"));
assertEquals(false, CategoryToClient.isCategory("S001101"));
assertEquals(false, CategoryToClient.isCategory("1101"));
}
@Test
public void testIsSubCategory() {
assertEquals(true, CategoryToClient.isSubCategory("S001101"));
assertEquals(false, CategoryToClient.isSubCategory("C000003"));
assertEquals(false, CategoryToClient.isSubCategory("1101"));
}
@Test
public void testGetCategoryID() {
assertEquals(3, CategoryToClient.getCategoryID("C000003"));
}
@Test
public void testGetSubCategoryID() {
assertEquals(1101, CategoryToClient.getSubCategoryID("S001101"));
}
@Test
public void testneedSubCategoryID() {
assertEquals(true, CategoryToClient.needSubCategoryID(3, "1,3"));
assertEquals(false, CategoryToClient.needSubCategoryID(3, "1,4,5"));
}
}