How to do orientaion validation in Appium?

please find below code and let me know is it correct approach or not for validation of screen orientaion.

        driver.rotate(ScreenOrientation.LANDSCAPE);

         if(driver.getOrientation().equals("LANDSCAPE")){
             System.out.println("PASS");
         }else{
             System.out.println("FAIL");
         }

u also need to catch exceptions thrown by
driver.rotate(ScreenOrientation.LANDSCAPE)
driver.getOrientation()

Amit,

Don’t have idea how to catch exceprions…please proide more info on the same
currently I’m using below code in my script

try{

logic…
}
catch (Exception e) {
System.out.println("Exception while adding a contact: " + e.getMessage());
}

yes what u r using is sufficient.