Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Violet UML Editor Core Framework- NetBeans IDE 8.2 File Edit View Navigate Sourc

ID: 3882629 • Letter: V

Question

Violet UML Editor Core Framework- NetBeans IDE 8.2 File Edit View Navigate Source Refactor Run Debug Profile Team Tools Window Help a Search (Ctrl+) Projects×| Files Services ×| PrefixDecoratorTest.javax Start Page Source History 15ublic class PrefixDecoratorTest 16 17 - Violet UML Edtor Core Framework a Source Packages eTest Packages com.horstmenn.violet.framework.graphics.content com.horstmann.vioet.product.diagram. abstracts.property.str| Test public void testsetPrefix) throws Exception Ecom.horstmann.violet.product.diagram.abstracts.property.s BoldDecoratorTest.java 1talcsDecoratorTest.java pref1xDecorator prefixDecorator new prefixDecorator (new OneLineText ("test"), "XYZ"); assertEquals("xyz test", prefixDecorator.toDisplay)): assertEquals("test", prefixDecorator.toEdit)) assertEquais("test" prefixDecorator.tostring ) 21 LargeSizeDecoratorTest.java OneLineStringDecoratorTest.java OneLineStringTest.java PrefiDecoratorTest.java 23 24 25 26 27 28 atorTest.java ReplaceSentenceDecoratorTest.java SmalSizeDecoratorTest.java Test public void testToDisplay () throws Exception UnderlineDecoratorTest.java Other Sources PrefixDecorator prefixDecoratornew PrefixDecorator (new OneLineText ("test")," ") assertEquais(" prefix> test", prefixDecorator.toDisplay)) 30 31 32 Project Site Project Fies B- b violet UML Edtor Parent Maven Project testSetPrefix - Navigator X BPrefixDecoratorTest O testSetPrefix0 testToDisplay0 com horstmann voet product dagram abstracts property string decorator. rendecoratorTest > test et refix Test ResultsOutput- Test (Violet UML Editor Parent Maven Project com.horstmann.violet:violet-framework:jar:2.5.3 X ,@ com horstmann violet.framework graphics content TextContentTest passed com.horstmann.violet.product.diagram.abstracts.property.string.decorator.BoldDecoratorTest passed com.horstmann.violet.product.diagram.abstracts.property.string.decorator.ItalicsDecoratorTest passed com.horstma.violet.product.diagram.abstracts.property.string.decorator.LargeSizeDecoratorTest passed com.horstman.violet.product.diagram.abstracts.property.string.decorator.OnelineStringDecoratorTest pasoed @ com.horstman.violet.product.diagram.abstracts.property.string.decorator.OneLineStringTest passed com.horstmann.violet.product.diagram.abstracts.property.string.decorator.PrefixDecoratorTest Failed com hors mann i let roduct dagram abstracts property sting decorator PrefinDecoratorTest testToDspay Faled: expected:CO test> but was:C A com. ostmann. oletproduct.dagram abstracts propert strng decorator PrefiaDecoratorTest test e Prefix Failed: expected:

Explanation / Answer

Problem is in this extra leading white space in return statement of PrefixDecorator.getPrefixToDisplay

/** * Allows to display prefix only if string to display is not empty * * @return string */ private String getPrefixToDisplay() { if (isStringToDisplayEmpty()) { return ""; } return " " + this.prefix + " "; }