You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@archiva.apache.org by Brett Porter <br...@apache.org> on 2007/11/06 12:03:55 UTC

Re: svn commit: r592297 - in /maven/archiva/trunk: archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/ archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/...

On 06/11/2007, at 5:16 PM, oching@apache.org wrote:

> - adjusted DaysOldRepositoryPurgeTest for the changes

but there's no tests for the actual changes... :)

> Modified: maven/archiva/trunk/archiva-base/archiva-consumers/ 
> archiva-core-consumers/src/test/java/org/apache/maven/archiva/ 
> consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java
> URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/ 
> archiva-consumers/archiva-core-consumers/src/test/java/org/apache/ 
> maven/archiva/consumers/core/repository/stubs/ 
> LuceneRepositoryContentIndexStub.java? 
> rev=592297&r1=592296&r2=592297&view=diff
> ====================================================================== 
> ========
> --- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core- 
> consumers/src/test/java/org/apache/maven/archiva/consumers/core/ 
> repository/stubs/LuceneRepositoryContentIndexStub.java (original)
> +++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core- 
> consumers/src/test/java/org/apache/maven/archiva/consumers/core/ 
> repository/stubs/LuceneRepositoryContentIndexStub.java Mon Nov  5  
> 22:16:12 2007
> @@ -46,7 +46,10 @@
>          throws RepositoryIndexException
>      {
>          // TODO Auto-generated method stub
> -        Assert.assertEquals( 2, records.size() );
> +        if( records.size() != 0 )
> +        {
> +            Assert.assertEquals( 2, records.size() );
> +        }
>      }

Is this likely to ever give a false-positive if it was meant to be  
two, but came out as 0?

Maybe it would be better to define the expected size in the  
constructor for the stub? (or use mock objects :)

Thanks,
Brett

--
Brett Porter - brett@apache.org
Blog: http://www.devzuz.org/blogs/bporter/


Re: svn commit: r592297 - in /maven/archiva/trunk: archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/ archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/...

Posted by Maria Odea Ching <oc...@exist.com>.
Brett Porter wrote:
>
> On 06/11/2007, at 5:16 PM, oching@apache.org wrote:
>
>> - adjusted DaysOldRepositoryPurgeTest for the changes
>
> but there's no tests for the actual changes... :)

Ooops, sorry about that :)

>
>> Modified: 
>> maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java 
>>
>> URL: 
>> http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java?rev=592297&r1=592296&r2=592297&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java 
>> (original)
>> +++ 
>> maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java 
>> Mon Nov  5 22:16:12 2007
>> @@ -46,7 +46,10 @@
>>          throws RepositoryIndexException
>>      {
>>          // TODO Auto-generated method stub
>> -        Assert.assertEquals( 2, records.size() );
>> +        if( records.size() != 0 )
>> +        {
>> +            Assert.assertEquals( 2, records.size() );
>> +        }
>>      }
>
> Is this likely to ever give a false-positive if it was meant to be 
> two, but came out as 0?

The deleteRecords(..) is still being invoked in the purge even if the 
list of records to be deleted is empty so the assert fails each time 
this method is invoked with that value.

>
> Maybe it would be better to define the expected size in the 
> constructor for the stub? (or use mock objects :)

I think I tried using mock objects for the tests before but encountered 
some problems with EasyMock's expect and return when a method parameter 
was created with "new [CLASS]()" inside of the class being tested. 
Anyway, I'll see what I can do about the tests :-)

>
> Thanks,
> Brett
>
> -- 
> Brett Porter - brett@apache.org
> Blog: http://www.devzuz.org/blogs/bporter/
>
>

Thanks,
Deng