File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed 
src/test/java/demo/customassert Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change 66public  class  ProductPageAssert  extends  AbstractAssert <ProductPageAssert , ProductPageValidator > {
77
88    SoftAssertions  assertions ;
9-     protected  ProductPageAssert (ProductPageValidator  productPageAssert ) {
10-         super (productPageAssert , ProductPageAssert .class );
9+     private  ProductPageAssert (ProductPageValidator  productPageValidator ) {
10+         super (productPageValidator , ProductPageAssert .class );
1111        assertions =new  SoftAssertions ();
1212    }
1313
14-     public  static  ProductPageValidator   getValidator ( ){
15-         return  null ;
14+     public  static  ProductPageAssert   assertThat ( ProductPageValidator   productPageValidator ){
15+         return  new   ProductPageAssert ( productPageValidator ) ;
1616    }
1717
1818    public  ProductPageAssert  productNameIs (String  productName ){
@@ -38,6 +38,4 @@ public ProductPageAssert matchesDefaultCartCount(){
3838    public  void  assertAll (){
3939        assertions .assertAll ();
4040    }
41- 
42- 
4341}
Original file line number Diff line number Diff line change 11package  demo .customassert ;
22
3- import  org .testng .Assert ;
43import  org .testng .annotations .Test ;
54
65public  class  ProductTest  extends  BaseTest {
@@ -9,8 +8,7 @@ public class ProductTest extends BaseTest{
98    public  void  verifyLoginPageSpec (){
109        ProductPage  productPage =ProductPage .getProductPage ();
1110        productPage .loadProductPage ();
12-         ProductPageAssert  productAssert =new  ProductPageAssert (productPage .getValidator ());
13-         productAssert 
11+         ProductPageAssert .assertThat (productPage .getValidator ())
1412                .productNameIs ("iPhone" )
1513                .productCodeIs ("product 11" )
1614                .productAvailabilityIs ("In Stock" )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments