Dear Lars and everyone,
Accuracy, I had modified TranslationService class and also its relevant others.
But I assure that I did not do any change on LocaleManager class, even two implementing classes of this one. But when using mvn test for it only and result is still failed. Why? Actually that, I do not understand what’s going on here? Very very very strange !
I am not good at Unit test case. Please help me solve this issue !
Please have a look at back in UnitTest_Bug_1.jpg figure.


MyTest.java (2.82 KB)
···
Anyway !
In this email, I will present out everything what I’ve done with Translation module as step by step by the each question and you guys can have a look at the attached files to get more reference.
-
Why must modify DefaultI18nService class ?
-
Which classes were also modified too ?
-
How did I do a test on the UnitTest file and What are they ?
- Why must modify DefaultI18nService class ?
As the presenting previously email, I had shown to you guys the logical bug which I’d got while testing on Translation module.
Map<String, String> convertTranslations( Collection translations )
This private method which is using for converting an input collection of translation to a map of translation with the key is property’s name and the value is property’s value.
So far ago, I recognized that its source would be well-done with the collection which contains one translation object only. One translation object have got only one property’s unique name. For example: name, shortname, comment, etc…
But the method above is really not well-done when received a collection which contains many translation object. Thus, I have tried fixing its logic and more flexible.
With the owned idea is that used the combination key as <Integer, String> or more exactly the map of translation should be as form
key :: objectID + “_” + the name of property
value :: the value of property
***See Figure 1 ***
- Which classes were also modified too ?
dhis-i18n-db ::
JAVA: I18nService, DefaultI18nService, DefaultTranslationService, HibernateTranslationStore.
XML: beans
dhis-api ::
JAVA: TranslationStore, TranslationService.
- How did I do a test on the UnitTest file and What are they ?
There are two classes TranslationStoreTest and I18nServiceTest
I tried commenting on all of their methods’ definition. And then, create a new one as MyTest.java file as an UnitTest class. Its content which is very very simple (file has been attached). It has only one method like this:
*********@Test
public void testAnything() throws Exception
{
assertTrue( id1 != id2 );
localeManager.setCurrentLocale( Locale.GERMAN );
}***
Next, using mvn test command for third of them. Finally, the response error was showing at MyTest class. I recognized is that from localeManager object.
That’s all !
2009/10/30 Lars Helge Øverland larshelge@gmail.com
Hi Hieu,
I am pretty sure this is caused by the changes you did to the TranslationService lately… So I guess you need to figure it out ;.)
Lars
–
Hieu.HISPVietnam
Good Health !