From fed8a48bad9ab1cf3161df2b086d60466301c79e Mon Sep 17 00:00:00 2001 From: Almaz Nasibullin Date: Wed, 5 Apr 2023 07:46:01 +0300 Subject: [PATCH] =?UTF-8?q?=D0=90=D0=B4=D0=B0=D0=BF=D1=82=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=81=D0=BB=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=D0=B0=20=D0=BD=D0=B0=20=D0=B0=D0=BA=D1=82=D1=83=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D1=83=D1=8E=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8?= =?UTF-8?q?=D1=8E=20EDT=202023.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MdStandardAttributeSynonymEmptyTest.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/com.e1c.v8codestyle.md.itests/src/com/e1c/v8codestyle/md/check/itests/MdStandardAttributeSynonymEmptyTest.java b/tests/com.e1c.v8codestyle.md.itests/src/com/e1c/v8codestyle/md/check/itests/MdStandardAttributeSynonymEmptyTest.java index e2f90826..7c9733d5 100644 --- a/tests/com.e1c.v8codestyle.md.itests/src/com/e1c/v8codestyle/md/check/itests/MdStandardAttributeSynonymEmptyTest.java +++ b/tests/com.e1c.v8codestyle.md.itests/src/com/e1c/v8codestyle/md/check/itests/MdStandardAttributeSynonymEmptyTest.java @@ -23,6 +23,7 @@ import com._1c.g5.v8.dt.metadata.mdclass.Catalog; import com._1c.g5.v8.dt.metadata.mdclass.StandardAttribute; import com._1c.g5.v8.dt.validation.marker.Marker; import com.e1c.g5.v8.dt.testing.check.SingleProjectReadOnlyCheckTestBase; +import com.e1c.v8codestyle.md.check.MdStandardAttributeSynonymEmpty; /** * The test for class {@link MdStandardAttributeSynonymEmpty}. @@ -68,7 +69,7 @@ public class MdStandardAttributeSynonymEmptyTest assertNotNull(marker); Catalog catalog = (Catalog)getTopObjectByFqn("Catalog.NegativeOwnerTestWithComment", dtProject); - StandardAttribute attribute = catalog.getStandardAttributes().get(0); + StandardAttribute attribute = getStandardAttributeByName(catalog, "Owner"); //$NON-NLS-1$ marker = getFirstMarker(CHECK_ID, attribute, dtProject); assertNotNull(marker); @@ -84,7 +85,7 @@ public class MdStandardAttributeSynonymEmptyTest assertNotNull(marker); Catalog catalog = (Catalog)getTopObjectByFqn("Catalog.NegativeParentTestWithComment", dtProject); - StandardAttribute attribute = catalog.getStandardAttributes().get(0); + StandardAttribute attribute = getStandardAttributeByName(catalog, "Parent"); //$NON-NLS-1$ marker = getFirstMarker(CHECK_ID, attribute, dtProject); assertNotNull(marker); } @@ -95,4 +96,15 @@ public class MdStandardAttributeSynonymEmptyTest return PROJECT_NAME; } + private StandardAttribute getStandardAttributeByName(Catalog catalog, String standardAttributeName) + { + for (StandardAttribute standardAttribute : catalog.getStandardAttributes()) + { + if (standardAttribute.getName().equals(standardAttributeName)) + { + return standardAttribute; + } + } + return null; + } }