From d5780e48f698c57afdbf1907af987d954a9b8fb7 Mon Sep 17 00:00:00 2001 From: matthew16550 Date: Mon, 29 Mar 2021 15:50:53 +1100 Subject: [PATCH] Extract SkinParam.getAsInt() method --- src/net/sourceforge/plantuml/SkinParam.java | 87 ++--- .../sourceforge/plantuml/SkinParamTest.java | 357 ++++++++++++++++++ 2 files changed, 380 insertions(+), 64 deletions(-) create mode 100644 test/net/sourceforge/plantuml/SkinParamTest.java diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index 99ed934b5..7421f15ad 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -493,22 +493,12 @@ public class SkinParam implements ISkinParam { } public int getCircledCharacterRadius() { - final String value = getValue("circledcharacterradius"); - if (value != null && value.matches("\\d+")) { - return Integer.parseInt(value); - } - // return 11; - // Log.println("SIZE1="+getFontSize(FontParam.CIRCLED_CHARACTER)); - // Log.println("SIZE1="+getFontSize(FontParam.CIRCLED_CHARACTER)/3); - return getFontSize(null, FontParam.CIRCLED_CHARACTER) / 3 + 6; + final int value = getAsInt("circledCharacterRadius", -1); + return value == -1 ? getFontSize(null, FontParam.CIRCLED_CHARACTER) / 3 + 6 : value; } public int classAttributeIconSize() { - final String value = getValue("classAttributeIconSize"); - if (value != null && value.matches("\\d+")) { - return Integer.parseInt(value); - } - return 10; + return getAsInt("classAttributeIconSize", 10); } public static Collection getPossibleValues() { @@ -594,11 +584,7 @@ public class SkinParam implements ISkinParam { } public int getDpi() { - final String value = getValue("dpi"); - if (value != null && value.matches("\\d+")) { - return Integer.parseInt(value); - } - return 96; + return getAsInt("dpi", 96); } public DotSplines getDotSplines() { @@ -850,19 +836,13 @@ public class SkinParam implements ISkinParam { } public double getNodesep() { - final String value = getValue("nodesep"); - if (value != null && value.matches("\\d+")) { - return Double.parseDouble(value); - } - return 0; + // TODO strange, this returns a double but only accepts integer values + return getAsInt("nodesep", 0); } public double getRanksep() { - final String value = getValue("ranksep"); - if (value != null && value.matches("\\d+")) { - return Double.parseDouble(value); - } - return 0; + // TODO strange, this returns a double but only accepts integer values + return getAsInt("ranksep", 0); } public double getDiagonalCorner(CornerParam param, Stereotype stereotype) { @@ -1000,11 +980,7 @@ public class SkinParam implements ISkinParam { } public double minClassWidth() { - final String value = getValue("minclasswidth"); - if (value != null && value.matches("\\d+")) { - return Integer.parseInt(value); - } - return 0; + return getAsInt("minclasswidth", 0); } public boolean sameClassWidth() { @@ -1052,15 +1028,8 @@ public class SkinParam implements ISkinParam { } public int groupInheritance() { - final String value = getValue("groupinheritance"); - int result = Integer.MAX_VALUE; - if (value != null && value.matches("\\d+")) { - result = Integer.parseInt(value); - } - if (result <= 1) { - result = Integer.MAX_VALUE; - } - return result; + final int value = getAsInt("groupinheritance", Integer.MAX_VALUE); + return value <= 1 ? Integer.MAX_VALUE : value; } public Guillemet guillemet() { @@ -1101,41 +1070,23 @@ public class SkinParam implements ISkinParam { } public int getTabSize() { - final String value = getValue("tabsize"); - if (value != null && value.matches("\\d+")) { - return Integer.parseInt(value); - } - return 8; + return getAsInt("tabsize", 8); } public int maxAsciiMessageLength() { - final String value = getValue("maxasciimessagelength"); - if (value != null && value.matches("\\d+")) { - return Integer.parseInt(value); - } - return -1; + return getAsInt("maxasciimessagelength", -1); } public int colorArrowSeparationSpace() { - final String value = getValue("colorarrowseparationspace"); - if (value != null && value.matches("\\d+")) { - return Integer.parseInt(value); - } - return 0; + return getAsInt("colorarrowseparationspace", 0); } public SplitParam getSplitParam() { final String border = getValue("pageBorderColor"); final String external = getValue("pageExternalColor"); - - final String marginString = getValue("pageMargin"); - int margin = 0; - if (marginString != null && marginString.matches("\\d+")) { - margin = Integer.parseInt(marginString); - } - final HColor borderColor = border == null ? null : getIHtmlColorSet().getColorOrWhite(border); final HColor externalColor = external == null ? null : getIHtmlColorSet().getColorOrWhite(external); + int margin = getAsInt("pageMargin", 0); return new SplitParam(borderColor, externalColor, margin); } @@ -1180,6 +1131,14 @@ public class SkinParam implements ISkinParam { return 0; } + private int getAsInt(String key, int defaultValue) { + final String value = getValue(key); + if (value != null && value.matches("\\d+")) { + return Integer.parseInt(value); + } + return defaultValue; + } + public boolean useRankSame() { return false; } diff --git a/test/net/sourceforge/plantuml/SkinParamTest.java b/test/net/sourceforge/plantuml/SkinParamTest.java new file mode 100644 index 000000000..8d0de337a --- /dev/null +++ b/test/net/sourceforge/plantuml/SkinParamTest.java @@ -0,0 +1,357 @@ +package net.sourceforge.plantuml; + +import net.sourceforge.plantuml.cucadiagram.Rankdir; +import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.skin.ActorStyle; +import net.sourceforge.plantuml.skin.Padder; +import net.sourceforge.plantuml.svek.ConditionEndStyle; +import net.sourceforge.plantuml.svek.ConditionStyle; +import net.sourceforge.plantuml.svek.PackageStyle; +import net.sourceforge.plantuml.svg.LengthAdjust; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; +import org.junit.jupiter.params.provider.EnumSource; + +import java.awt.Color; + +import static org.assertj.core.api.Assertions.assertThat; + +class SkinParamTest { + + // + // Test Cases + // + + /** + * A long and verbose test method! + * But it helps us to avoid accidentally changing a default style. + */ + @ParameterizedTest + @EnumSource(UmlDiagramType.class) + public void testDefaultValues(UmlDiagramType umlDiagramType) { + + final SkinParam skinParam = SkinParam.create(umlDiagramType); + final Stereotype fooStereotype = new Stereotype("foo"); + + assertThat(skinParam.actorStyle()).isEqualTo(ActorStyle.STICKMAN); + + assertThat(skinParam.getAllSpriteNames()).isEmpty(); + + assertThat(skinParam.getBackgroundColor(false)).isEqualTo(HColorUtils.WHITE); + assertThat(skinParam.getBackgroundColor(true)).isEqualTo(HColorUtils.WHITE); + + assertThat(skinParam.getCircledCharacter(fooStereotype)).isEqualTo('\0'); + + assertThat(skinParam.getCircledCharacterRadius()).isEqualTo(11); + + assertThat(skinParam.classAttributeIconSize()).isEqualTo(10); + + assertThat(skinParam.colorArrowSeparationSpace()).isZero(); + + assertThat(skinParam.getColorMapper()).isInstanceOf(ColorMapperIdentity.class); + + assertThat(skinParam.componentStyle()).isEqualTo(ComponentStyle.UML2); + + assertThat(skinParam.getConditionEndStyle()).isEqualTo(ConditionEndStyle.DIAMOND); + + assertThat(skinParam.getConditionStyle()).isEqualTo(ConditionStyle.INSIDE_HEXAGON); + + assertThat(skinParam.getDefaultSkin()).isEqualTo("plantuml.skin"); + + assertThat(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT)).isEqualTo(HorizontalAlignment.LEFT); + + assertThat(skinParam.getDiagonalCorner(CornerParam.agent, null)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.archimate, null)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.card, null)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.component, null)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.DEFAULT, null)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.rectangle, null)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.diagramBorder, null)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.titleBorder, null)).isZero(); + + assertThat(skinParam.getDiagonalCorner(CornerParam.agent, fooStereotype)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.archimate, fooStereotype)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.card, fooStereotype)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.component, fooStereotype)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.DEFAULT, fooStereotype)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.diagramBorder, fooStereotype)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.rectangle, fooStereotype)).isZero(); + assertThat(skinParam.getDiagonalCorner(CornerParam.titleBorder, fooStereotype)).isZero(); + + assertThat(skinParam.displayGenericWithOldFashion()).isFalse(); + + assertThat(skinParam.getDotSplines()).isEqualTo(DotSplines.SPLINES); + + assertThat(skinParam.getDpi()).isEqualTo(96); + + assertThat(skinParam.fixCircleLabelOverlapping()).isFalse(); + + assertThat(skinParam.forceSequenceParticipantUnderlined()).isFalse(); + + assertThat(skinParam.getHyperlinkColor()).isEqualTo(HColorUtils.BLUE); + + assertThat(skinParam.getlengthAdjust()).isEqualTo(LengthAdjust.SPACING); + + assertThat(skinParam.groupInheritance()).isEqualTo(Integer.MAX_VALUE); + + assertThat(skinParam.guillemet()).isEqualTo(Guillemet.GUILLEMET); + + assertThat(skinParam.handwritten()).isFalse(); + + assertThat(skinParam.hoverPathColor()).isNull(); + + assertThat(skinParam.isUseVizJs()).isFalse(); + + final LineBreakStrategy lineBreakStrategy = skinParam.maxMessageSize(); + assertThat(lineBreakStrategy.isAuto()).isFalse(); + assertThat(lineBreakStrategy.getMaxWidth()).isZero(); + + assertThat(skinParam.maxAsciiMessageLength()).isEqualTo(-1); + + assertThat(skinParam.minClassWidth()).isZero(); + + assertThat(skinParam.getMonospacedFamily()).isEqualTo("monospaced"); + + assertThat(skinParam.getNodesep()).isZero(); + + assertThat(skinParam.packageStyle()).isEqualTo(PackageStyle.FOLDER); + + assertThat(skinParam.getPadding()).isZero(); + assertThat(skinParam.getPadding(PaddingParam.BOX)).isZero(); + assertThat(skinParam.getPadding(PaddingParam.PARTICIPANT)).isZero(); + + assertThat(skinParam.getPreserveAspectRatio()).isEqualTo("none"); + + assertThat(skinParam.getRankdir()).isEqualTo(Rankdir.TOP_TO_BOTTOM); + + assertThat(skinParam.getRanksep()).isZero(); + + assertThat(skinParam.responseMessageBelowArrow()).isFalse(); + + assertThat(skinParam.getRoundCorner(CornerParam.agent, null)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.archimate, null)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.card, null)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.component, null)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.DEFAULT, null)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.rectangle, null)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.diagramBorder, null)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.titleBorder, null)).isZero(); + + assertThat(skinParam.getRoundCorner(CornerParam.agent, fooStereotype)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.archimate, fooStereotype)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.card, fooStereotype)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.component, fooStereotype)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.DEFAULT, fooStereotype)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.diagramBorder, fooStereotype)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.rectangle, fooStereotype)).isZero(); + assertThat(skinParam.getRoundCorner(CornerParam.titleBorder, fooStereotype)).isZero(); + + assertThat(skinParam.sameClassWidth()).isFalse(); + + assertThat(skinParam.sequenceDiagramPadder()).isEqualTo(Padder.NONE); + + assertThat(skinParam.shadowing(null)).isTrue(); + assertThat(skinParam.shadowing(fooStereotype)).isTrue(); + + assertThat(skinParam.shadowingForNote(null)).isTrue(); + assertThat(skinParam.shadowingForNote(fooStereotype)).isTrue(); + + final SplitParam splitParam = skinParam.getSplitParam(); + assertThat(splitParam.getBorderColor()).isNull(); + assertThat(splitParam.getExternalColor()).isNull(); + assertThat(splitParam.getExternalMargin()).isZero(); + + assertThat(skinParam.getStereotypeAlignment()).isEqualTo(HorizontalAlignment.CENTER); + + assertThat(skinParam.stereotypePositionTop()).isTrue(); + + assertThat(skinParam.strictUmlStyle()).isFalse(); + + assertThat(skinParam.svgDimensionStyle()).isTrue(); + + assertThat(skinParam.getSvgLinkTarget()).isEqualTo("_top"); + + assertThat(skinParam.swimlaneWidth()).isZero(); + + final LineBreakStrategy swimlaneWrapTitleWidth = skinParam.swimlaneWrapTitleWidth(); + assertThat(swimlaneWrapTitleWidth.isAuto()).isFalse(); + assertThat(swimlaneWrapTitleWidth.getMaxWidth()).isZero(); + + assertThat(skinParam.getTabSize()).isEqualTo(8); + + assertThat(skinParam.getThickness(LineParam.activityBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.agentBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.archimateBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.arrow, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.cardBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.classBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.componentBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.designedDomainBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.diagramBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.domainBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.hexagonBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.legendBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.machineBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.noteBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.objectBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.packageBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.partitionBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.queueBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.rectangleBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.requirementBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceActorBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceArrow, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceDividerBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceGroupBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceLifeLineBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceParticipantBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceReferenceBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.swimlaneBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.titleBorder, null)).isNull(); + assertThat(skinParam.getThickness(LineParam.usecaseBorder, null)).isNull(); + + assertThat(skinParam.getThickness(LineParam.activityBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.agentBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.archimateBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.arrow, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.cardBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.classBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.componentBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.designedDomainBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.diagramBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.domainBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.hexagonBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.legendBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.machineBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.noteBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.objectBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.packageBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.partitionBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.queueBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.rectangleBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.requirementBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceActorBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceArrow, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceDividerBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceGroupBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceLifeLineBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceParticipantBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.sequenceReferenceBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.swimlaneBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.titleBorder, fooStereotype)).isNull(); + assertThat(skinParam.getThickness(LineParam.usecaseBorder, fooStereotype)).isNull(); + + final TikzFontDistortion tikzFontDistortion = skinParam.getTikzFontDistortion(); + assertThat(tikzFontDistortion.getDistortion()).isEqualTo(4.0); + assertThat(tikzFontDistortion.getMagnify()).isEqualTo(1.20); + + assertThat(skinParam.useOctagonForActivity(null)).isFalse(); + assertThat(skinParam.useOctagonForActivity(fooStereotype)).isFalse(); + + assertThat(skinParam.useRankSame()).isFalse(); + + assertThat(skinParam.useSwimlanes(umlDiagramType)).isFalse(); + + assertThat(skinParam.useUnderlineForHyperlink()).isTrue(); + + final LineBreakStrategy wrapWidth = skinParam.wrapWidth(); + assertThat(wrapWidth.isAuto()).isFalse(); + assertThat(wrapWidth.getMaxWidth()).isZero(); + } + + @Test + public void testCircledCharacterRadius() { + final SkinParam skinParam = createSkinParam("circledCharacterRadius", "123"); + assertThat(skinParam.getCircledCharacterRadius()).isEqualTo(123); + } + + @Test + public void testClassAttributeIconSize() { + final SkinParam skinParam = createSkinParam("classAttributeIconSize", "123"); + assertThat(skinParam.classAttributeIconSize()).isEqualTo(123); + } + + @Test + public void testDpi() { + final SkinParam skinParam = createSkinParam("dpi", "123"); + assertThat(skinParam.getDpi()).isEqualTo(123); + } + + @ParameterizedTest + @CsvSource({ + "0, MAX_VALUE", + "1, MAX_VALUE", + "2, 2", + "123, 123" + }) + public void testGroupInheritance(String paramValue, String expectedValue) { + final SkinParam skinParam = createSkinParam("groupInheritance", paramValue); + assertThat(skinParam.groupInheritance()).isEqualTo(intFromCsv(expectedValue)); + } + + @Test + public void testMaxAsciiMessageLength() { + final SkinParam skinParam = createSkinParam("maxAsciiMessageLength", "123"); + assertThat(skinParam.maxAsciiMessageLength()).isEqualTo(123); + } + + @Test + public void testMinClassWidth() { + final SkinParam skinParam = createSkinParam("minClassWidth", "123"); + assertThat(skinParam.minClassWidth()).isEqualTo(123); + } + + @Test + public void testNodeSep() { + final SkinParam skinParam = createSkinParam("nodeSep", "123"); + assertThat(skinParam.getNodesep()).isEqualTo(123); + } + + @Test + public void testRankSep() { + final SkinParam skinParam = createSkinParam("rankSep", "123"); + assertThat(skinParam.getRanksep()).isEqualTo(123); + } + + @Test + public void testSplitParam() { + final SkinParam skinParam = createSkinParam( + "pageBorderColor", "red", + "pageExternalColor", "yellow", + "pageMargin", "123" + ); + + final SplitParam splitParam = skinParam.getSplitParam(); + assertThat(splitParam.getBorderColor()).isEqualTo(Color.RED); + assertThat(splitParam.getExternalColor()).isEqualTo(Color.YELLOW); + assertThat(splitParam.getExternalMargin()).isEqualTo(123); + } + + @Test + public void testTabSize() { + final SkinParam skinParam = createSkinParam("tabSize", "123"); + assertThat(skinParam.getTabSize()).isEqualTo(123); + } + + // + // Test DSL + // + + private SkinParam createSkinParam(String... keyValuePairs) { + // Using SEQUENCE here is an arbitrary decision that should not affect test outcome + final SkinParam skinParam = SkinParam.create(UmlDiagramType.SEQUENCE); + for (int i = 0; i < keyValuePairs.length; i += 2) { + skinParam.setParam(StringUtils.goLowerCase(keyValuePairs[i]), keyValuePairs[i + 1]); + } + return skinParam; + } + + private int intFromCsv(String value) { + return value.equals("MAX_VALUE") ? Integer.MAX_VALUE : Integer.parseInt(value); + } +}