diff options
Diffstat (limited to 'src/test/java/org/apache/commons/lang3/builder/ToStringStyleTest.java')
-rw-r--r-- | src/test/java/org/apache/commons/lang3/builder/ToStringStyleTest.java | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringStyleTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringStyleTest.java new file mode 100644 index 000000000..02399b6db --- /dev/null +++ b/src/test/java/org/apache/commons/lang3/builder/ToStringStyleTest.java @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.lang3.builder; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.apache.commons.lang3.AbstractLangTest; +import org.junit.jupiter.api.Test; + +/** + * Test case for ToStringStyle. + */ +public class ToStringStyleTest extends AbstractLangTest { + + private static class ToStringStyleImpl extends ToStringStyle { + private static final long serialVersionUID = 1L; + + } + + @Test + public void testSetArrayStart() { + final ToStringStyle style = new ToStringStyleImpl(); + style.setArrayStart(null); + assertEquals("", style.getArrayStart()); + } + + @Test + public void testSetArrayEnd() { + final ToStringStyle style = new ToStringStyleImpl(); + style.setArrayEnd(null); + assertEquals("", style.getArrayEnd()); + } + + @Test + public void testSetArraySeparator() { + final ToStringStyle style = new ToStringStyleImpl(); + style.setArraySeparator(null); + assertEquals("", style.getArraySeparator()); + } + + @Test + public void testSetContentStart() { + final ToStringStyle style = new ToStringStyleImpl(); + style.setContentStart(null); + assertEquals("", style.getContentStart()); + } + + @Test + public void testSetContentEnd() { + final ToStringStyle style = new ToStringStyleImpl(); + style.setContentEnd(null); + assertEquals("", style.getContentEnd()); + } + + @Test + public void testSetFieldNameValueSeparator() { + final ToStringStyle style = new ToStringStyleImpl(); + style.setFieldNameValueSeparator(null); + assertEquals("", style.getFieldNameValueSeparator()); + } + + @Test + public void testSetFieldSeparator() { + final ToStringStyle style = new ToStringStyleImpl(); + style.setFieldSeparator(null); + assertEquals("", style.getFieldSeparator()); + } + + @Test + public void testSetNullText() { + final ToStringStyle style = new ToStringStyleImpl(); + style.setNullText(null); + assertEquals("", style.getNullText()); + } + + @Test + public void testSetSizeStartText() { + final ToStringStyle style = new ToStringStyleImpl(); + style.setSizeStartText(null); + assertEquals("", style.getSizeStartText()); + } + + @Test + public void testSetSizeEndText() { + final ToStringStyle style = new ToStringStyleImpl(); + style.setSizeEndText(null); + assertEquals("", style.getSizeEndText()); + } + + @Test + public void testSetSummaryObjectStartText() { + final ToStringStyle style = new ToStringStyleImpl(); + style.setSummaryObjectStartText(null); + assertEquals("", style.getSummaryObjectStartText()); + } + + @Test + public void testSetSummaryObjectEndText() { + final ToStringStyle style = new ToStringStyleImpl(); + style.setSummaryObjectEndText(null); + assertEquals("", style.getSummaryObjectEndText()); + } + + /** + * An object used to test {@link ToStringStyle}. + * + */ + static class Person { + /** + * Test String field. + */ + String name; + + /** + * Test integer field. + */ + int age; + + /** + * Test boolean field. + */ + boolean smoker; + } +} |