From 092e9c5107ef628a17673e4b3975a9b3e37f820a Mon Sep 17 00:00:00 2001 From: Michail Plushnikov Date: Sat, 3 Dec 2022 17:58:43 +0100 Subject: [PATCH] [lombok] drop redundant code and tests GitOrigin-RevId: 7bb6bb8630119569879fd62225c480252088f90e --- .../plugin/thirdparty/LombokUtils.java | 24 +- .../plugin/thirdparty/LombokHandlerUtil.java | 310 ------------------ .../thirdparty/LombokUtilsAllGetterTest.java | 6 - .../thirdparty/LombokUtilsAllSetterTest.java | 5 - .../thirdparty/LombokUtilsAllWitherTest.java | 5 - .../thirdparty/LombokUtilsGetterTest.java | 7 +- .../LombokUtilsPrefixedFluentTest.java | 7 +- .../thirdparty/LombokUtilsSetterTest.java | 7 +- .../thirdparty/LombokUtilsWitherTest.java | 7 +- 9 files changed, 18 insertions(+), 360 deletions(-) delete mode 100644 plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokHandlerUtil.java diff --git a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtils.java b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtils.java index e5201a94aaf1..7b05f3e97df9 100644 --- a/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtils.java +++ b/plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtils.java @@ -379,7 +379,7 @@ public final class LombokUtils { return getGetterName(psiField, accessorsInfo); } - public static String getGetterName(@NotNull PsiField psiField, AccessorsInfo accessorsInfo) { + public static String getGetterName(@NotNull PsiField psiField, @NotNull AccessorsInfo accessorsInfo) { final String psiFieldName = psiField.getName(); final boolean isBoolean = PsiType.BOOLEAN.equals(psiField.getType()); @@ -391,10 +391,14 @@ public final class LombokUtils { return getSetterName(psiField, accessorsInfo); } - public static String getSetterName(@NotNull PsiField psiField, AccessorsInfo accessorsInfo) { + public static String getSetterName(@NotNull PsiField psiField, @NotNull AccessorsInfo accessorsInfo) { return toSetterName(accessorsInfo, psiField.getName(), PsiType.BOOLEAN.equals(psiField.getType())); } + public static String getWitherName(@NotNull PsiField psiField, @NotNull AccessorsInfo accessorsInfo) { + return toWitherName(accessorsInfo.withFluent(false), psiField.getName(), PsiType.BOOLEAN.equals(psiField.getType())); + } + /** * Generates a getter name from a given field name. *

@@ -415,7 +419,7 @@ public final class LombokUtils { * @param isBoolean if the field is of type 'boolean'. For fields of type {@code java.lang.Boolean}, you should provide {@code false}. * @return The getter name for this field, or {@code null} if this field does not fit expected patterns and therefore cannot be turned into a getter name. */ - public static String toGetterName(AccessorsInfo accessors, String fieldName, boolean isBoolean) { + public static String toGetterName(@NotNull AccessorsInfo accessors, String fieldName, boolean isBoolean) { return toAccessorName(accessors, fieldName, isBoolean, "is", "get"); } @@ -439,7 +443,7 @@ public final class LombokUtils { * @param isBoolean if the field is of type 'boolean'. For fields of type {@code java.lang.Boolean}, you should provide {@code false}. * @return The setter name for this field, or {@code null} if this field does not fit expected patterns and therefore cannot be turned into a getter name. */ - public static String toSetterName(AccessorsInfo accessors, String fieldName, boolean isBoolean) { + public static String toSetterName(@NotNull AccessorsInfo accessors, String fieldName, boolean isBoolean) { return toAccessorName(accessors, fieldName, isBoolean, "set", "set"); } @@ -462,14 +466,14 @@ public final class LombokUtils { * @param isBoolean if the field is of type 'boolean'. For fields of type {@code java.lang.Boolean}, you should provide {@code false}. * @return The wither name for this field, or {@code null} if this field does not fit expected patterns and therefore cannot be turned into a getter name. */ - public static String toWitherName(AccessorsInfo accessors, String fieldName, boolean isBoolean) { + public static String toWitherName(@NotNull AccessorsInfo accessors, String fieldName, boolean isBoolean) { if (accessors.isFluent()) { throw new IllegalArgumentException("@Wither does not support @Accessors(fluent=true)"); } return toAccessorName(accessors, fieldName, isBoolean, "with", "with"); } - private static String toAccessorName(AccessorsInfo accessorsInfo, + private static String toAccessorName(@NotNull AccessorsInfo accessorsInfo, String fieldName, boolean isBoolean, String booleanPrefix, @@ -508,7 +512,7 @@ public final class LombokUtils { * @param fieldName the name of the field. * @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}. */ - public static Collection toAllGetterNames(AccessorsInfo accessorsInfo, String fieldName, boolean isBoolean) { + public static Collection toAllGetterNames(@NotNull AccessorsInfo accessorsInfo, String fieldName, boolean isBoolean) { return toAllAccessorNames(accessorsInfo, fieldName, isBoolean, "is", "get"); } @@ -521,7 +525,7 @@ public final class LombokUtils { * @param fieldName the name of the field. * @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}. */ - public static Collection toAllSetterNames(AccessorsInfo accessorsInfo, String fieldName, boolean isBoolean) { + public static Collection toAllSetterNames(@NotNull AccessorsInfo accessorsInfo, String fieldName, boolean isBoolean) { return toAllAccessorNames(accessorsInfo, fieldName, isBoolean, "set", "set"); } @@ -534,14 +538,14 @@ public final class LombokUtils { * @param fieldName the name of the field. * @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}. */ - public static Collection toAllWitherNames(AccessorsInfo accessorsInfo, String fieldName, boolean isBoolean) { + public static Collection toAllWitherNames(@NotNull AccessorsInfo accessorsInfo, String fieldName, boolean isBoolean) { if (accessorsInfo.isFluent()) { throw new IllegalArgumentException("@Wither does not support @Accessors(fluent=true)"); } return toAllAccessorNames(accessorsInfo, fieldName, isBoolean, "with", "with"); } - private static Collection toAllAccessorNames(AccessorsInfo accessorsInfo, + private static Collection toAllAccessorNames(@NotNull AccessorsInfo accessorsInfo, String fieldName, boolean isBoolean, String booleanPrefix, diff --git a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokHandlerUtil.java b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokHandlerUtil.java deleted file mode 100644 index 1abff7c29433..000000000000 --- a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokHandlerUtil.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (C) 2013-2015 The Project Lombok Authors. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package de.plushnikov.intellij.plugin.thirdparty; - -import de.plushnikov.intellij.plugin.processor.field.AccessorsInfo; -import org.jetbrains.annotations.NotNull; - -import java.util.*; - -/** - * Container for static utility methods useful for some standard lombok handlers, regardless of - * target platform (e.g. useful for both javac and Eclipse lombok implementations). - */ -public class LombokHandlerUtil { - /** - * Given the name of a field, return the 'base name' of that field. For example, {@code fFoobar} becomes {@code foobar} if {@code f} is in the prefix list. - * For prefixes that end in a letter character, the next character must be a non-lowercase character (i.e. {@code hashCode} is not {@code ashCode} even if - * {@code h} is in the prefix list, but {@code hAshcode} would become {@code ashCode}). The first prefix that matches is used. If the prefix list is empty, - * or the empty string is in the prefix list and no prefix before it matches, the fieldName will be returned verbatim. - *

- * If no prefix matches and the empty string is not in the prefix list and the prefix list is not empty, {@code null} is returned. - * - * @param fieldName The full name of a field. - * @param prefixes A list of prefixes, usually provided by the {@code Accessors} settings annotation, listing field prefixes. - * @return The base name of the field. - */ - public static CharSequence removePrefix(CharSequence fieldName, List prefixes) { - if (prefixes == null || prefixes.isEmpty()) { - return fieldName; - } - - fieldName = fieldName.toString(); - - outer: - for (String prefix : prefixes) { - if (prefix.length() == 0) { - return fieldName; - } - if (fieldName.length() <= prefix.length()) { - continue outer; - } - for (int i = 0; i < prefix.length(); i++) { - if (fieldName.charAt(i) != prefix.charAt(i)) { - continue outer; - } - } - char followupChar = fieldName.charAt(prefix.length()); - // if prefix is a letter then follow-up letter needs to not be lowercase, i.e. 'foo' is not a match - // as field named 'oo' with prefix 'f', but 'fOo' would be. - if (Character.isLetter(prefix.charAt(prefix.length() - 1)) && - Character.isLowerCase(followupChar)) { - continue outer; - } - return String.valueOf(Character.toLowerCase(followupChar)) + fieldName.subSequence(prefix.length() + 1, fieldName.length()); - } - - return null; - } - - - /** - * Generates a getter name from a given field name. - *

- * Strategy: - *

- * - * @param accessors Accessors configuration. - * @param fieldName the name of the field. - * @param isBoolean if the field is of type 'boolean'. For fields of type {@code java.lang.Boolean}, you should provide {@code false}. - * @return The getter name for this field, or {@code null} if this field does not fit expected patterns and therefore cannot be turned into a getter name. - */ - public static String toGetterName(@NotNull AccessorsInfo accessors, CharSequence fieldName, boolean isBoolean) { - return toAccessorName(accessors, fieldName, isBoolean, "is", "get", true); - } - - /** - * Generates a setter name from a given field name. - *

- * Strategy: - *

- * - * @param accessors Accessors configuration. - * @param fieldName the name of the field. - * @param isBoolean if the field is of type 'boolean'. For fields of type {@code java.lang.Boolean}, you should provide {@code false}. - * @return The setter name for this field, or {@code null} if this field does not fit expected patterns and therefore cannot be turned into a getter name. - */ - public static String toSetterName(@NotNull AccessorsInfo accessors, CharSequence fieldName, boolean isBoolean) { - return toAccessorName(accessors, fieldName, isBoolean, "set", "set", true); - } - - /** - * Generates a wither name from a given field name. - *

- * Strategy: - *

- * - * @param accessors Accessors configuration. - * @param fieldName the name of the field. - * @param isBoolean if the field is of type 'boolean'. For fields of type {@code java.lang.Boolean}, you should provide {@code false}. - * @return The wither name for this field, or {@code null} if this field does not fit expected patterns and therefore cannot be turned into a getter name. - */ - public static String toWitherName(@NotNull AccessorsInfo accessors, CharSequence fieldName, boolean isBoolean) { - if (accessors.isFluent()) { - throw new IllegalArgumentException("@Wither does not support @Accessors(fluent=true)"); - } - return toAccessorName(accessors, fieldName, isBoolean, "with", "with", false); - } - - private static String toAccessorName(@NotNull AccessorsInfo accessors, CharSequence fieldName, boolean isBoolean, - String booleanPrefix, String normalPrefix, boolean adhereToFluent) { - - fieldName = fieldName.toString(); - if (fieldName.length() == 0) { - return null; - } - - if (Boolean.TRUE.equals(accessors.isDoNotUseIsPrefix())) { - isBoolean = false; - } - boolean explicitFluent = accessors.isFluent();//accessors.isExplicit("fluent"); - - List prefix = Arrays.asList(accessors.getPrefixes()); - boolean fluent = explicitFluent && accessors.isFluent(); - - fieldName = removePrefix(fieldName, prefix); - if (fieldName == null) { - return null; - } - - String fName = fieldName.toString(); - if (adhereToFluent && fluent) { - return fName; - } - - if (isBoolean && fName.startsWith("is") && fieldName.length() > 2 && !Character.isLowerCase(fieldName.charAt(2))) { - // The field is for example named 'isRunning'. - return booleanPrefix + fName.substring(2); - } - - return buildAccessorName(isBoolean ? booleanPrefix : normalPrefix, fName); - } - - /** - * Returns all names of methods that would represent the getter for a field with the provided name. - *

- * For example if {@code isBoolean} is true, then a field named {@code isRunning} would produce:
- * {@code [isRunning, getRunning, isIsRunning, getIsRunning]} - * - * @param accessors Accessors configuration. - * @param fieldName the name of the field. - * @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}. - */ - public static List toAllGetterNames(AccessorsInfo accessors, CharSequence fieldName, boolean isBoolean) { - return toAllAccessorNames(accessors, fieldName, isBoolean, "is", "get", true); - } - - /** - * Returns all names of methods that would represent the setter for a field with the provided name. - *

- * For example if {@code isBoolean} is true, then a field named {@code isRunning} would produce:
- * {@code [setRunning, setIsRunning]} - * - * @param accessors Accessors configuration. - * @param fieldName the name of the field. - * @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}. - */ - public static List toAllSetterNames(AccessorsInfo accessors, CharSequence fieldName, boolean isBoolean) { - return toAllAccessorNames(accessors, fieldName, isBoolean, "set", "set", true); - } - - /** - * Returns all names of methods that would represent the wither for a field with the provided name. - *

- * For example if {@code isBoolean} is true, then a field named {@code isRunning} would produce:
- * {@code [withRunning, withIsRunning]} - * - * @param accessors Accessors configuration. - * @param fieldName the name of the field. - * @param isBoolean if the field is of type 'boolean'. For fields of type 'java.lang.Boolean', you should provide {@code false}. - */ - public static List toAllWitherNames(AccessorsInfo accessors, CharSequence fieldName, boolean isBoolean) { - if (accessors.isFluent()) { - throw new IllegalArgumentException("@Wither does not support @Accessors(fluent=true)"); - } - return toAllAccessorNames(accessors, fieldName, isBoolean, "with", "with", false); - } - - private static List toAllAccessorNames(@NotNull AccessorsInfo accessors, CharSequence fieldName, boolean isBoolean, - String booleanPrefix, String normalPrefix, boolean adhereToFluent) { - - if (Boolean.TRUE.equals(accessors.isDoNotUseIsPrefix())) { - isBoolean = false; - } - if (!isBoolean) { - String accessorName = toAccessorName(accessors, fieldName, false, booleanPrefix, normalPrefix, adhereToFluent); - return (accessorName == null) ? Collections.emptyList() : Collections.singletonList(accessorName); - } - - boolean explicitFluent = accessors.isFluent(); - boolean fluent = explicitFluent && accessors.isFluent(); - - if (fieldName == null) { - return Collections.emptyList(); - } - - List baseNames = toBaseNames(fieldName, fluent); - - Set names = new HashSet<>(); - for (String baseName : baseNames) { - if (adhereToFluent && fluent) { - names.add(baseName); - } else { - names.add(buildAccessorName(normalPrefix, baseName)); - if (!normalPrefix.equals(booleanPrefix)) { - names.add(buildAccessorName(booleanPrefix, baseName)); - } - } - } - - return new ArrayList<>(names); - - } - - private static List toBaseNames(CharSequence fieldName, boolean fluent) { - List baseNames = new ArrayList<>(); - baseNames.add(fieldName.toString()); - - // isPrefix = field is called something like 'isRunning', so 'running' could also be the fieldname. - String fName = fieldName.toString(); - if (fName.startsWith("is") && fName.length() > 2 && !Character.isLowerCase(fName.charAt(2))) { - String baseName = fName.substring(2); - if (fluent) { - baseNames.add(Character.toLowerCase(baseName.charAt(0)) + baseName.substring(1)); - } else { - baseNames.add(baseName); - } - } - - return baseNames; - } - - /** - * @param prefix Something like {@code get} or {@code set} or {@code is}. - * @param suffix Something like {@code running}. - * @return prefix + smartly title-cased suffix. For example, {@code setRunning}. - */ - public static String buildAccessorName(String prefix, String suffix) { - if (suffix.length() == 0) { - return prefix; - } - if (prefix.length() == 0) { - return suffix; - } - - char first = suffix.charAt(0); - if (Character.isLowerCase(first)) { - boolean useUpperCase = suffix.length() > 2 && - (Character.isTitleCase(suffix.charAt(1)) || Character.isUpperCase(suffix.charAt(1))); - suffix = String.format("%s%s", - useUpperCase ? Character.toUpperCase(first) : Character.toTitleCase(first), - suffix.subSequence(1, suffix.length())); - } - return String.format("%s%s", prefix, suffix); - } -} diff --git a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsAllGetterTest.java b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsAllGetterTest.java index 408c53971d1e..793ad7c071df 100644 --- a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsAllGetterTest.java +++ b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsAllGetterTest.java @@ -13,17 +13,11 @@ import static org.hamcrest.MatcherAssert.assertThat; public class LombokUtilsAllGetterTest { - private final List lombokResult = new ArrayList<>(); private final List result = new ArrayList<>(); private void makeResults(String fieldName, boolean isBoolean, AccessorsInfo accessorsInfo) { - lombokResult.clear(); result.clear(); - - lombokResult.addAll(LombokHandlerUtil.toAllGetterNames(accessorsInfo, fieldName, isBoolean)); result.addAll(LombokUtils.toAllGetterNames(accessorsInfo, fieldName, isBoolean)); - - assertThat(result, is(lombokResult)); } @Test diff --git a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsAllSetterTest.java b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsAllSetterTest.java index b06a30081946..1ca1e787a867 100644 --- a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsAllSetterTest.java +++ b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsAllSetterTest.java @@ -13,17 +13,12 @@ import static org.hamcrest.MatcherAssert.assertThat; public class LombokUtilsAllSetterTest { - private final List lombokResult = new ArrayList<>(); private final List result = new ArrayList<>(); private void makeResults(String fieldName, boolean isBoolean) { - lombokResult.clear(); result.clear(); - lombokResult.addAll(LombokHandlerUtil.toAllSetterNames(AccessorsInfo.DEFAULT, fieldName, isBoolean)); result.addAll(LombokUtils.toAllSetterNames(AccessorsInfo.DEFAULT, fieldName, isBoolean)); - - assertThat(result, is(lombokResult)); } @Test diff --git a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsAllWitherTest.java b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsAllWitherTest.java index 6b1b4d5aa6e1..928ca02787d7 100644 --- a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsAllWitherTest.java +++ b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsAllWitherTest.java @@ -13,18 +13,13 @@ import static org.hamcrest.MatcherAssert.assertThat; public class LombokUtilsAllWitherTest { - private final List lombokResult = new ArrayList<>(); private final List result = new ArrayList<>(); private void makeResults(String fieldName, boolean isBoolean) { - lombokResult.clear(); result.clear(); final AccessorsInfo accessorsInfo = AccessorsInfo.DEFAULT; - lombokResult.addAll(LombokHandlerUtil.toAllWitherNames(accessorsInfo, fieldName, isBoolean)); result.addAll(LombokUtils.toAllWitherNames(accessorsInfo, fieldName, isBoolean)); - - assertThat(result, is(lombokResult)); } @Test diff --git a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsGetterTest.java b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsGetterTest.java index aa8c6ab0d134..929751939eda 100644 --- a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsGetterTest.java +++ b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsGetterTest.java @@ -4,17 +4,12 @@ import de.plushnikov.intellij.plugin.processor.field.AccessorsInfo; import org.junit.Test; import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; public class LombokUtilsGetterTest { private static String makeResults(String fieldName, boolean isBoolean) { - String lombokResult = LombokHandlerUtil.toGetterName(AccessorsInfo.DEFAULT, fieldName, isBoolean); - String result = LombokUtils.toGetterName(AccessorsInfo.DEFAULT, fieldName, isBoolean); - - assertThat(result, is(lombokResult)); - return result; + return LombokUtils.toGetterName(AccessorsInfo.DEFAULT, fieldName, isBoolean); } @Test diff --git a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsPrefixedFluentTest.java b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsPrefixedFluentTest.java index 69c13955ea76..30ce12d2ea80 100644 --- a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsPrefixedFluentTest.java +++ b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsPrefixedFluentTest.java @@ -4,7 +4,6 @@ import de.plushnikov.intellij.plugin.processor.field.AccessorsInfo; import org.junit.Test; import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; public class LombokUtilsPrefixedFluentTest { @@ -13,11 +12,7 @@ public class LombokUtilsPrefixedFluentTest { CapitalizationStrategy.defaultValue(), "m", ""); private static String makeResults(String fieldName, boolean isBoolean) { - String lombokResult = LombokHandlerUtil.toGetterName(ACCESSORS, fieldName, isBoolean); - String result = LombokUtils.toGetterName(ACCESSORS, fieldName, isBoolean); - - assertThat(result, is(lombokResult)); - return result; + return LombokUtils.toGetterName(ACCESSORS, fieldName, isBoolean); } @Test diff --git a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsSetterTest.java b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsSetterTest.java index ae41f78cf200..f1aa944e7d76 100644 --- a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsSetterTest.java +++ b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsSetterTest.java @@ -4,17 +4,12 @@ import de.plushnikov.intellij.plugin.processor.field.AccessorsInfo; import org.junit.Test; import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; public class LombokUtilsSetterTest { private static String makeResults(String fieldName, boolean isBoolean) { - String lombokResult = LombokHandlerUtil.toSetterName(AccessorsInfo.DEFAULT, fieldName, isBoolean); - String result = LombokUtils.toSetterName(AccessorsInfo.DEFAULT, fieldName, isBoolean); - - assertThat(result, is(lombokResult)); - return result; + return LombokUtils.toSetterName(AccessorsInfo.DEFAULT, fieldName, isBoolean); } @Test diff --git a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsWitherTest.java b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsWitherTest.java index c3fa1136aa92..f381bc142ce1 100644 --- a/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsWitherTest.java +++ b/plugins/lombok/src/test/java/de/plushnikov/intellij/plugin/thirdparty/LombokUtilsWitherTest.java @@ -4,18 +4,13 @@ import de.plushnikov.intellij.plugin.processor.field.AccessorsInfo; import org.junit.Test; import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; public class LombokUtilsWitherTest { private static String makeResults(String fieldName, boolean isBoolean) { final AccessorsInfo accessorsInfo = AccessorsInfo.DEFAULT; - String lombokResult = LombokHandlerUtil.toWitherName(accessorsInfo, fieldName, isBoolean); - String result = LombokUtils.toWitherName(accessorsInfo, fieldName, isBoolean); - - assertThat(result, is(lombokResult)); - return result; + return LombokUtils.toWitherName(accessorsInfo, fieldName, isBoolean); } @Test