Amit Bhalla
Amit Bhalla

Reputation: 1

I want to call string parameter from error message class placed in helping package to my test case class of test package

package com.matchmove.helpingfiles;

public class prefundErrorMessages {

    public static String error_description_when_special_character_inserted_in_product_code = 
            "ProductCode: regular expression mismatch";
}
package com.matchmove.tests;

import com.matchmove.testbase.Base;

import com.matchmove.helpingfiles.prefundErrorMessages;


public class PrefundProductPostTest extends Base {

    protected static Logger logger = LoggerFactory.getLogger(PrefundProductPostTest.class.getName());

    String generatedString = RandomStringGeneration.randomstring();

    Faker fake = new Faker();

    ProductPayloadPOJO product = new ProductPayloadPOJO();

    @BeforeClass

    public void setup() {

        logger.info("");
        RestAssured.baseURI = prefundbaseURL;
        httpRequest = RestAssured.given();

@Test(description="validate that BVA and EQP for Product code field in request")
    
    public void validateproductCode() {
        
        
        
        logger.info("Checking BVA and EQP for Product code ");
        
        product.setProduct_code("Test@123" + generatedString);
        
        response=given().header("Authorization",productauth).and().body(product).when
                  () .patch("/product");
        
        int statuscode = response.getStatusCode();
        Assert.assertEquals(statuscode, 400);
        
        String responsebody = response.getBody().asString();
        Assert.assertTrue(responsebody != null);
        
        String description=response.jsonPath().getString("description");

//      want to validate my error description here from helping package string like assert.assertequals(description.errormessages);
        
        

    }

Upvotes: 0

Views: 84

Answers (0)

Related Questions