Hi Chris,
Casting didn't help either it came up with new issues. however, completely
commenting out the method with Job type fixed the errors for me. Just FYI
protected <P extends Job> P configRoundtrip(P job) throws Exception { ... }
On Monday, 25 June 2012 08:54:43 UTC+10, Christopher wrote:
>
> The signatures are nearly but not exactly the same. The return type
> defines that P is either a Job or an Item.
>
> You can fix your code with a cast:
> configRoundtrip((Item) p);
>
> Regards,
> Chris
>
>
> On 06/20/2012 09:59 AM, Esben Rugbjerg wrote:
> > Hi,
> >
> > In HudsonTestCase.java the configRoundtrip are defined like this:
> >
> > /**
> > * Loads a configuration page and submits it without any modifications,
> to
> > * perform a round-trip configuration test.
> > * <p>
> > * See
> >
> http://wiki.jenkins-ci.org/display/JENKINS/Unit+Test#UnitTest-Configurationroundtriptesting
>
> > */
> > protected <P extends Job> P configRoundtrip(P job) throws Exception {
> >
> submit(createWebClient().getPage(job,"configure").getFormByName("config"));
> > return job;
> > }
> >
> > protected <P extends Item> P configRoundtrip(P job) throws Exception {
> > submit(createWebClient().getPage(job,
> "configure").getFormByName("config"));
> > return job;
> > }
> >
> > As you can see there are two methods with same signature concerning
> > input arguments. I don't know if this is the problem ?
> >
> > Regards
> > Esben
> >
> > On Tuesday, June 19, 2012 7:14:52 PM UTC+2, stitcher wrote:
> >
> > Hi Esben,
> >
> > Are there any other methods in SCMCheckoutStrategyTest with the same
> > signature as configRoundtrip?
> >
> > Andrey
> >
> > On Jun 19, 2012, at 2:12 AM, Esben Rugbjerg <> wrote:
> >
> >> Hi,
> >>
> >> I get the following error when I try to use Eclipse as a IDE: "The
> >> method configRoundtrip(FreeStyleProject) is ambiguous for the type
> >> SCMCheckoutStrategyTest"
> >>
> >> The error occurs here:
> >>
> jenkins-test-harness/src/main/java/jenkins/scm/SCMCheckoutStrategyTest.java:
>
> >>
> >> /**
> >> * This should show the UI.
> >> */
> >> public void testConfigRoundtrip2() throws Exception {
> >> assertEquals(2,SCMCheckoutStrategyDescriptor.all().size());
> >> FreeStyleProject p = createFreeStyleProject();
> >> System.out.println(SCMCheckoutStrategyDescriptor.all());
> >>
> >> TestSCMCheckoutStrategy before = new TestSCMCheckoutStrategy();
> >> p.setScmCheckoutStrategy(before);
> >> configRoundtrip(p); <--- THE ERROR
> >> SCMCheckoutStrategy after = p.getScmCheckoutStrategy();
> >> assertNotSame(before,after);
> >> assertSame(before.getClass(), after.getClass());
> >>
> >> assertTrue(pageHasUI(p));
> >> }
> >>
> >> It looks like the error is related to the one described in the
> >> thread "Trying to build Jenkins Core, but getting errors" but I am
> >> not sure.
> >>
> >> The project builds when I use Maven from the command line but it
> >> would be great if I could also build it through Eclipse without
> >> errors.
> >>
> >> Regards
> >> Esben
> >
>
>