Good grief! You must test awkward cases like that. If you don't, you are risking serious errors going undetected. If the API is going to take care of it, what does the API say that ensures your method will work correctly?Laura Miclescu wrote: . . .
-i can't know what will happen on 31st January 2014 + 1 month, i am only able to fint the curretn billing period, minus or plus one month, i cannot test it for this example; i suppose the API should take care of that, isn't that the point of it?
. . .
Have you read the documentation? What does it say about Calendar and GregorianCalendar?Laura Miclescu wrote: . . .
-is it ok or not to use both Calendar and GregorianCalendar? Does that impact the results i get?
. . .
You can't. You can however create a class which has both values as fields. There already is such a class in the Java8 date and time API. Stop using Calendar and GregorianCalendar.Laura Miclescu wrote: . . .
-how to return two values from a method? . . .
Laura Miclescu wrote:My method is called pretty straightforward: isWithinBillingPeriod(int BILLDAY, String TEMP_OPTOUT_DATE). The two parameters are the bill day (beginning of billing period, first day) and a string variable representing the date i want to find out if it's within the billing period or not.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Laura Miclescu wrote:I was thinking, can i form an array with my two resulting values (startDate, endDate) and return this array?
Evacuate the building! Here, take this tiny ad with you:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|