/**
- * Copyright 2016-2017 ZTE Corporation.
+ * Copyright 2017 ZTE Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.onap.workflow.resources;
-import static org.junit.Assert.assertTrue;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
+import org.junit.Assert;
import org.junit.Test;
-import org.mockito.InjectMocks;
import org.onap.workflow.activitiext.common.ToolUtil;
/**
*
*/
public class ToolUtilTest {
+ @Test
+ public void testIsEmptyString() {
+ Assert.assertEquals(true, ToolUtil.isEmptyString(null));
+ Assert.assertEquals(true, ToolUtil.isEmptyString(""));
+ Assert.assertEquals(false, ToolUtil.isEmptyString("test"));
+ }
- @InjectMocks
- private ToolUtil toolUtil;
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {}
-
- /**
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownAfterClass() throws Exception {}
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {}
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {}
-
- @SuppressWarnings("static-access")
@Test
- public void test() {
- toolUtil.isEmptyString(null);
+ public void testisTrimedEmptyString() {
+ Assert.assertEquals(true, ToolUtil.isTrimedEmptyString(null));
+ Assert.assertEquals(true, ToolUtil.isTrimedEmptyString(""));
+ Assert.assertEquals(false, ToolUtil.isTrimedEmptyString("test"));
}
+ @Test
+ public void testisTrimedEmptyArray() {
+ String[] originArray = new String[1];
+ originArray[0] = "122";
+ Assert.assertEquals(true, ToolUtil.isTrimedEmptyArray(null));
+ Assert.assertEquals(true, ToolUtil.isTrimedEmptyArray(new String[0]));
+ Assert.assertEquals(false, ToolUtil.isTrimedEmptyArray(originArray));
+ }
}