Hi Nickolai,

 

Very good suggestion. It works.

 

Thanks for advice!

 

Regards,

Rafał Laczek

Dnia 4-09-2009 o godz. 16:49 Nickolai Kurutin napisał(a):
Hi, Rafał.
Problem is connected with variable scope.
Try this:
public void test3_
compareTwoNamesIgnoringCase(){
         String name1="passion";
         String name2="beauty";
         NameHandler instance = new NameHandler();
         System.out.println("Result of CompareTwoNamesIgnoringCase for
name1=passion and
         name2=beauty is "+instance.compareTwoNamesIgnoringCase(name1, name2));
     }


2009/9/4 Rafał Laczek <rafal_lac...@wp.pl>

Hi Colleagues,

In NameHandler.java I have following method:
public int compareTwoNamesIgnoringCase(String name1, String name2){
       return result= name1.compareToIgnoreCase(name2);
   }

and in NameHandlerTest.java there is also following method:
public void test3_compareTwoNamesIgnoringCase(){
         String name1="passion";
         String name2="beauty";
         NameHandler instance = new NameHandler();
         instance.compareTwoNamesIgnoringCase(name1, name2);
         System.out.println("Result of CompareTwoNamesIgnoringCase for
name1=passion and
         name2=beauty is "+result);
     }

I don't know why the response is "Result of CompareTwoNamesIgnoringCase
for name1=passion and name2=beauty is 0"
As you can note the variable name1 and name2 are different and that's
why the result should be different than "0"
When I m doing the JUnit test the project is working fine.
Please advise me where there is an error.

Thanks

Best regards,
Rafał Laczek

----------------------------------------------------
GRAMY FAIR PLAY , NIE MNOŻYMY OPŁAT  - Konferencje w Trójmieście
http://klik.wp.pl/?adr=www.nadmorski.pl&sid=850







--
Best regards,
Nickolai Kurutin





----------------------------------------------------
EuroBasket 2009 - Kibicuj z nami!
wszystko o Mistrzostwach Europy koszykarzy
Kliknij: http://klik.wp.pl/?adr=http://corto.www.wp.pl/as/eurobasket2009-2.html&sid=851
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?...
-~----------~----~----~----~------~----~------~--~---

Reply via email to