Dave Tolls

+ Follow
since Sep 04, 2013
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dave Tolls

I probably saw Morecambe and Wise around the same time (mid 70s, maybe earlier), and those two shared a bed.
I have always placed Bert and Ernie in the same category...it helped that Wise was a (little) Ern as well.
3 days ago
Excel doesn't have different types of numeric, just different formats (which would be irrelevant to you if all you want is the value?).

So why don't you use POI to just read the number out using the getNumericCellValue method?
You can then format it as you like.
Since you are just testing the method, and have other parts mocked out, then there is no need to use other parts of your code to create things like a User, since you are mocking out bits of that anyway.

In the second example, you are using a mocked taskActions, and are providing a user, so I'm not sure why you need ot do the sign in, since you could simply create a User by hand (as you did).
6 days ago
Just a minor restructure of the test, so it follows the setup/execute/check pattern a bit more closely:

So, a few points.

What's the:
registration.createUser("admin", "123");
line for?  It doesn't seem to be related to the method under test at all, or am I missing something?

If it isn't related to the login.signIn method then I would remove that, and the associated verify for userActions.createUser (since I expect that's where that occurs).

You should store the value returned by the signIn call, and use that value in the assertTrue, rather than calling the code a second time.

You also should be doing a test to check that the correct value for connectedUser.getId() is returned (assuming you can actually access the connectedUser object in the test?).
That will involve mocking the call to retrieveUserId so it returns something other than the default 0.
6 days ago
The java command takes the full classname of the main class, not the file path.
So it's:
java packageb.ClassB

(I suspect that ',' was a typo, Norm?)
6 days ago
What does the book.ticket table look like and what are you actually trying to compare?

At the moment it looks like you are selecting all the time values for tickets marked as planning, and all the time values for tickets marked as closed.
So what defines which planning time is subtracted from which closing time?
If you are getting a NPE on that line then fnolService must be null.
6 days ago
Why do you care what the mocked service does, since (apart from throwing an exception, which is possibly something worth testing how your instance-under-test handles that) it does nothing that can affect thething you are testing.

Yes, as I say, write a test where it throws an exception, but mocking anything else is pointless.

ETA:  This is not taking into account a verify check, to ensure the method is called, but that's not the same as a when clause.
1 week ago
Don't use the one button for both interactions.
Use two buttons, but only display the one you want them to be able to interact with.

That way your button method only has to deal with one type of interaction and not have to figure out what it is supposed to do.

When one of the buttons is clicked you can setVisibility to View.GONE and set the other button to View.VISIBLE.
1 week ago
There's got to be more as it isn't telling you the exception that's been thrown.
That is indeed the issue.
If you want to know what the RootPane is, the Swing Tutorial at Oracle explains:
Each top-level container relies on a reclusive intermediate container called the root pane. The root pane manages the content pane and the menu bar, along with a couple of other containers. You generally don't need to know about root panes to use Swing components. However, if you ever need to intercept mouse clicks or paint over multiple components, you should get acquainted with root panes.
So the JPanel (or one of them) that you get back from the components in the RootPane is the content pane.
1 week ago

Liutauras Vilda wrote:
You may be surprised, but in London, in particular London City district, I'd say there are more business's who have than those who are not. Question is whether those cafes provide paid services or free of charge. Most of them are paid I'd guess, like yet another local cafe just outside the building.

There are?
Why do all the city-folk go out lunching then?

Seems like a large expense for the company to provide food (and I'm thinking a full on cafeteria here, not somewhere to make coffee and sit and eat your sarnies) and all the associated cost, considering the ground rent in the City.

Worked in a couple around the Oxford Street area, and they definitely didn't, even if they were a reasonable sized company.
1 week ago

Campbell Ritchie wrote:
Anyway, that means the Powwow class doesn't inherit the static wow() method from the Pow interface in the first place, but does inherit it from its superclass Wow. So it can never print “Pow”.

And you can show that by having Powwow not extend Wow, but just implement Pow.
The code won't compile as f.wow() is referencing a non-existent method on the object.
The only places I've been at that have had a cafeteria have been sites that are a couple of miles (usually more) from the nearest food place.
Do lots of businesses in San Francisco really have cafes on site when there is a wide choice of options outside the office?
1 week ago
What happens when you uncomment line 18 in that first bit of code (assuming that your real code has the correct braces)?
1 week ago