google-code-export / activeweb

Automatically exported from code.google.com/p/activeweb
0 stars 0 forks source link

capitalize method in invokeBoolean in Expectation.java does not handle camel case method names. #105

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

if I try to do this test

a(obj).shouldBe("AsTallAsLions"); 

It will fail to find the matching method. It will erroneously try to call 
"isAstallaslions" and "hasAsTallAsLions". The issue is that it is lowercasing 
the later part of the string in the capitalize method in Expectation.java

Please apply this small patch:

Index: javalite-common/src/main/java/org/javalite/test/jspec/Expectation.java
===================================================================
--- 
javalite-common/src/main/java/org/javalite/test/jspec/Expectation.java  (revision
 776)
+++ 
javalite-common/src/main/java/org/javalite/test/jspec/Expectation.java  (working 
copy)
@@ -290,7 +290,7 @@

     private String capitalize(String s) {
         if (s.length() == 0) return s;
-        return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
+        return s.substring(0, 1).toUpperCase() + s.substring(1);
     }

     /**

Original issue reported on code.google.com by evan.leo...@gmail.com on 29 May 2012 at 5:34

GoogleCodeExporter commented 9 years ago
Evan, what is the expected behaviour here, i.e. what is the method name that 
cannot be called with existing implementation?

Original comment by ipolevoy@gmail.com on 29 May 2012 at 7:50

GoogleCodeExporter commented 9 years ago
Sorry if the example wasn't clear. Was getting late. Here's the exact method 
that can't be called:

public boolean isKnownAsRole()

When invokeBoolean is called it tries to call "isKnownasrole", which fails.

Original comment by evan.leo...@gmail.com on 29 May 2012 at 2:08

GoogleCodeExporter commented 9 years ago
Moved to: http://code.google.com/p/activejdbc/issues/detail?id=162

Original comment by ipolevoy@gmail.com on 29 May 2012 at 10:40