Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#368 FIX #376

Merged
merged 2 commits into from
May 1, 2016
Merged

#368 FIX #376

merged 2 commits into from
May 1, 2016

Conversation

SrinivasanTarget
Copy link
Member

Change list

ClassCast Exception fix in AppiumFieldDecorator class

Types of changes

What types of changes are you proposing/introducing to Java client?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Details

Fixes classcast exception on AppiumFieldDecorator class

#368

@TikhomirovSergey please review

@TikhomirovSergey
Copy link
Contributor

TikhomirovSergey commented Apr 29, 2016

@SrinivasanTarget
This fix is invalid. These tests throw NullPointerExeption.
https://github.com/appium/java-client/tree/master/src/test/java/io/appium/java_client/pagefactory_tests/widgets

There is a test which I've made up:

package io.appium.java_client.pagefactory_tests;


import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.PageFactory;

import java.util.List;
import java.util.Set;

public class GenericTest {

    static class TempGenericPage<T> {

        public List<T> items;

        public List<T> getItems() {
            return items;
        }
    }

    static class MockWebDriver implements WebDriver {

        @Override
        public void get(String url) {

        }

        @Override
        public String getCurrentUrl() {
            return null;
        }

        @Override
        public String getTitle() {
            return null;
        }

        @Override
        public List<WebElement> findElements(By by) {
            return null;
        }

        @Override
        public WebElement findElement(By by) {
            return null;
        }

        @Override
        public String getPageSource() {
            return null;
        }

        @Override
        public void close() {

        }

        @Override
        public void quit() {

        }

        @Override
        public Set<String> getWindowHandles() {
            return null;
        }

        @Override
        public String getWindowHandle() {
            return null;
        }

        @Override
        public TargetLocator switchTo() {
            return null;
        }

        @Override
        public Navigation navigate() {
            return null;
        }

        @Override
        public Options manage() {
            return null;
        }
    }

    @Test
    public void genericTestCse() {
        PageFactory.initElements(new AppiumFieldDecorator(new MockWebDriver()), new TempGenericPage<Object>());
    }
}

Please use it, mentioned tests and these tests to validate the fix.

@SrinivasanTarget
Copy link
Member Author

@TikhomirovSergey Please take a look at this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants