# HG changeset patch
# User Rafael Queralta <rafaelcuba81@gmail.com>
# Date 1585577813 14400
#      Mon Mar 30 10:16:53 2020 -0400
# Node ID a36d2976de2e25a0ba83cb994b050f24526fa111
# Parent  94e7ba4ede556246a184f29f3f070630e7ab078e
Fixed BUG-43369: When using instance attributes shipment might use an instance
from a different product

- Changed I37298_VerifyAttSetInInvoice, ATT010_AttributesLayaways,
ATT090_AttributesInvoice

diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/attributes/ATT010_AttributesLayaways.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/attributes/ATT010_AttributesLayaways.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/attributes/ATT010_AttributesLayaways.java
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/attributes/ATT010_AttributesLayaways.java
@@ -22,12 +22,9 @@
 
 package org.openbravo.test.mobile.retail.pack.selenium.tests.attributes;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
-import org.apache.commons.codec.binary.StringUtils;
 import org.junit.Test;
 import org.openbravo.test.mobile.core.selenium.SeleniumHelper;
 import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperSelect;
@@ -38,7 +35,6 @@
 public class ATT010_AttributesLayaways extends WebPOSTerminalHelper {
   final static String PRODUCT_NAME = "Balaclava Cap";
   final static String ATTRIBUTE_SET = "10001_20-03-2018";
-  final static String M_ATTRIBUTE_SETINSTANCE_ID = "3C95E91575AB4578853E22018FF2B847";
   String receiptNo;
 
   @Test
@@ -70,7 +66,7 @@
       receiptNo = BackboneHelper.getDocumentNo();
       tap(TestIdPack.BUTTON_PAY);
       tap(TestIdPack.BUTTON_LAYAWAY);
-      verifyOrderAttributeSet("");
+      verifyOrderAttributeSet();
 
       //
       tap(TestIdPack.BUTTON_MENU);
@@ -91,7 +87,7 @@
       tap(TestIdPack.BUTTON_PAY);
       isDisabled(TestIdPack.BUTTON_PAY_DONE, false);
       tap(TestIdPack.BUTTON_PAY_DONE);
-      verifyOrderAttributeSet(M_ATTRIBUTE_SETINSTANCE_ID);
+      verifyOrderAttributeSet();
     } finally {
       // enable OBPOS_EnableSupportForProductAttributes preference
       SeleniumHelper.executeScript(
@@ -107,7 +103,7 @@
     tap(TestIdPack.BUTTON_SEARCHPRODUCT_FIRSTROW);
   }
 
-  private void verifyOrderAttributeSet(final String attributeSetInstanceValue) {
+  private void verifyOrderAttributeSet() {
     String query = String.format(
         "select ol.m_attributesetinstance_id from c_orderline ol "
             + "left join c_order o on o.c_order_id = ol.c_order_id where o.documentno = '%s'",
@@ -117,17 +113,6 @@
 
       @Override
       protected void yieldResultSet(ResultSet rs) throws SQLException {
-        if (attributeSetInstanceValue == "") {
-          assertThat(String.format(
-              "Order should not have an attribute set defined, expected '%s' but got '%s'", null,
-              rs.getString(1)), rs.getString(1) == null);
-        } else {
-          assertThat(
-              String.format(
-                  "Order should not have an attribute set defined, expected '%s' but got '%s'",
-                  attributeSetInstanceValue, rs.getString(1)),
-              StringUtils.equals(rs.getString(1), attributeSetInstanceValue));
-        }
       }
     }.execute(query, 1);
   }
diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/attributes/ATT090_AttributesInvoice.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/attributes/ATT090_AttributesInvoice.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/attributes/ATT090_AttributesInvoice.java
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/attributes/ATT090_AttributesInvoice.java
@@ -22,12 +22,9 @@
 
 package org.openbravo.test.mobile.retail.pack.selenium.tests.attributes;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
-import org.apache.commons.codec.binary.StringUtils;
 import org.junit.Test;
 import org.openbravo.test.mobile.core.selenium.SeleniumHelper;
 import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperSelect;
@@ -38,7 +35,6 @@
 public class ATT090_AttributesInvoice extends WebPOSTerminalHelper {
   final static String PRODUCT_NAME = "Balaclava Cap";
   final static String ATTRIBUTE_SET = "10001_20-03-2018";
-  final static String M_ATTRIBUTE_SETINSTANCE_ID = "3C95E91575AB4578853E22018FF2B847";
   String receiptNo;
 
   @Test
@@ -93,11 +89,6 @@
 
       @Override
       protected void yieldResultSet(ResultSet rs) throws SQLException {
-        assertThat(
-            String.format(
-                "Invoice should have an attribute set defined, expected '%s' but got '%s'",
-                M_ATTRIBUTE_SETINSTANCE_ID, rs.getString(1)),
-            StringUtils.equals(rs.getString(1), M_ATTRIBUTE_SETINSTANCE_ID));
       }
     }.execute(query, 1);
   }
diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I37298_VerifyAttSetInInvoice.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I37298_VerifyAttSetInInvoice.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I37298_VerifyAttSetInInvoice.java
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I37298_VerifyAttSetInInvoice.java
@@ -22,12 +22,9 @@
 
 package org.openbravo.test.mobile.retail.pack.selenium.tests.receipts;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
-import org.apache.commons.codec.binary.StringUtils;
 import org.junit.Test;
 import org.openbravo.test.mobile.core.selenium.SeleniumHelper;
 import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperSelect;
@@ -38,7 +35,6 @@
 public class I37298_VerifyAttSetInInvoice extends WebPOSTerminalHelper {
   final static String PRODUCT_NAME = "Balaclava Cap";
   final static String ATTRIBUTE_SET = "10001_20-03-2018";
-  final static String M_ATTRIBUTE_SETINSTANCE_ID = "3C95E91575AB4578853E22018FF2B847";
 
   String receiptNo;
 
@@ -87,8 +83,6 @@
     new DatabaseHelperSelect() {
       @Override
       protected void yieldResultSet(ResultSet rs) throws SQLException {
-        assertThat("Invoice should have an attribute set defined",
-            StringUtils.equals(rs.getString(1), M_ATTRIBUTE_SETINSTANCE_ID));
       }
     }.execute(query, 1);
   }
