Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 4482 invoked from network); 25 Nov 2009 10:18:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Nov 2009 10:18:09 -0000 Received: (qmail 23059 invoked by uid 500); 25 Nov 2009 10:18:09 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 23008 invoked by uid 500); 25 Nov 2009 10:18:09 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 22998 invoked by uid 99); 25 Nov 2009 10:18:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Nov 2009 10:18:09 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.218.211 as permitted sender) Received: from [209.85.218.211] (HELO mail-bw0-f211.google.com) (209.85.218.211) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Nov 2009 10:18:06 +0000 Received: by bwz3 with SMTP id 3so7627170bwz.36 for ; Wed, 25 Nov 2009 02:17:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=HD9ZFrQAm1JAUiTkKJsoc6pd2Xe4LfxUz+xcXWXRHCc=; b=XuRNYxrZ+86O09qj5g6uYio9pwomMBq+cen0F5fx5UxxnONyz+e1U4BbYQg/nP5JfH awzLy6KrZ4HWfgs2qw3DELa0Am90piDqjFpRsf32Kyrk7Fq5MzzamJrrCeBN8r2riIbd JgaLCjXMFxCKAMwYptLXE7kJza3vT6JMJ6fyg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=nGA6Sao6CVdZtJpFOALbSlN8s5EqeH4fVIiI6jg5b6dgRztZvCVjvq3pJzOImxDjHd 6nxJMf9szQ85zRmUR23ssXJxcrhaYfQcXcTebjhFX2r33JvYu2nXF468jAu9XFAQwmmy hA2XX1K6scaqpq80B1CLhp31aOJ5TuJYmM9Ts= MIME-Version: 1.0 Received: by 10.204.3.219 with SMTP id 27mr7371659bko.127.1259144265093; Wed, 25 Nov 2009 02:17:45 -0800 (PST) In-Reply-To: <26510164.post@talk.nabble.com> References: <26509915.post@talk.nabble.com> <5380c69c0911250148y40211873qf3f9b48c0c8129f0@mail.gmail.com> <26510164.post@talk.nabble.com> From: Claus Ibsen Date: Wed, 25 Nov 2009 11:17:25 +0100 Message-ID: <5380c69c0911250217s3a3c9b8dn7e18b7180791f6aa@mail.gmail.com> Subject: Re: Bug in expectedBodiesReceived(List<>) To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Thanks I have looked into it. Its in fact Java that picks the varargs method always even if you drop in a List type. So I am fixing it to detect this in the varargs and cater for that. On Wed, Nov 25, 2009 at 11:04 AM, eirilwan wrote: > > Very simple test: > =A0 =A0@Produce(uri =3D "direct:start2") > =A0 =A0protected ProducerTemplate start2Consumer; > > =A0 =A0@EndpointInject(uri =3D "mock:consumer") > =A0 =A0private MockEndpoint registrationConsumer; > > =A0 =A0//this fails. > =A0 =A0@Test > =A0 =A0public void shouldAcceptListAsExpectedBodyButFails() throws > InterruptedException { > =A0 =A0 =A0 =A0List list =3D new ArrayList(); > =A0 =A0 =A0 =A0list.add("test1"); > =A0 =A0 =A0 =A0registrationConsumer.expectedBodiesReceived(list); > =A0 =A0 =A0 =A0start2Consumer.sendBody("test1"); > =A0 =A0 =A0 =A0registrationConsumer.assertIsSatisfied(); > =A0 =A0} > =A0 =A0//This is ok > =A0 =A0@Test > =A0 =A0public void shouldAcceptListAsExpectedBody() throws InterruptedExc= eption > { > =A0 =A0 =A0 =A0List list =3D new ArrayList(); > =A0 =A0 =A0 =A0list.add("test1"); > > registrationConsumer.expectedBodiesReceived(list.toArray(String[list.size= ()]); > =A0 =A0 =A0 =A0start2Consumer.sendBody("test1"); > =A0 =A0 =A0 =A0registrationConsumer.assertIsSatisfied(); > =A0 =A0} > > Route is simple: > =A0 =A0 =A0 =A0from("direct:start2").to("mock:consumer"); > > > No real issue since I just rewrote the tests to use varargs. Just wanted = to > let you know :) > > regards > Eirik L. Wang > > > Claus Ibsen-2 wrote: >> >> Hi >> >> We have a gazillion unit tests with uses the mock component. >> However many of them use the vararg variation. >> >> Maybe if you can post a bit more code what you do, can help identify you= r >> issue. >> >> >> On Wed, Nov 25, 2009 at 10:45 AM, eirilwan wrote: >>> >>> When we started using 2.1-SNAPSHOT, a lot of existing unit-tests broke.= I >>> figured out why. We were setting up expectedBodiesReceived with a list, >>> which caused a strange message (mock://registrationConsumer Body of >>> message: >>> 0. Expected: <[test0]> but was: >> >>> If I added a .toArray(new String[bodies.size()]), it started working >>> again. >>> >>> registrationConsumer.expectedBodiesReceived(bodies.toArray(new >>> String[bodies.size()])); >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Bug-in-expectedBodiesReceived%28List%3C%3E%29-tp2= 6509915p26509915.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Author of Camel in Action: http://www.manning.com/ibsen/ >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > > -- > View this message in context: http://old.nabble.com/Bug-in-expectedBodies= Received%28List%3C%3E%29-tp26509915p26510164.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > --=20 Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus