lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Djuzhev" <do...@dataart.com>
Subject RE: Problem: final modifier (e.g. Document) prevents Mocked Unit Tests
Date Fri, 01 Aug 2003 16:11:50 GMT
ehlo.


> Have you tried using RAMDirectory rather than FSDirectory for your 
> index during testing?

  No, I'll take a look on it, thanx.

> Yup, I use mocks myself.

  Hello, brother in arms! ;)

> If you can show a use case of where extensions are necessary beyond
testing

  Do you think this one reason is not enough? ;/

  Well, I'll see what can I do with RAM/FS Directory, but
  really: how do you think can I test the following logic
  without using MockDocument and MockField?

===================================
            if( name.equals(Indexer.FIELD_RELATIVE_URL) ) {
                document.add(Field.Keyword(name,value.toString()));
            } else if( name.equals(Indexer.FIELD_CREATED) ) {
 
document.add(Field.Keyword(name,DateField.dateToString((Date)value)));
            } else if( name.equals(Indexer.FIELD_TEXT) ) {
                document.add(Field.UnStored(name,value.toString()));
            } else if( name.equals(Indexer.FIELD_CATEGORIES) ) {
                document.add(Field.Text(name,value.toString()));

            } else {
                // dozen: yes, I know it matches prev line; I'm not sure
this default is right
                // so it's subject to change
                document.add(Field.Keyword(name,value.toString()));
            }
===================================

  In short: here I shall perform different actions depending on
  keys and (not implemented yet) types of objects (f.ex, for Date's
  I have to use dateToString()).

  Can it be achived without Mocks (and not running actual tests)?

dozen
http://dozen.ru

Mime
View raw message