Feature - Implemented Reducing number of warnings: Raw Types (DisplayCaseManager)

fredg1

Member
Adds Generics to DisplayCaseManager and other related outside methods.
 

Attachments

  • DisplayCaseManagerRawTypes.patch
    6.2 KB · Views: 0

fredg1

Member
@heeheehee Same problem, opposite cause.
This time, the method to test is too close to the end user.

The method to test is void move( final List<AdventureResult> moving, final int sourceShelf, final int destinationShelf ), whose only action is to do
Java:
        RequestThread.postRequest( new DisplayCaseRequest( moving.toArray( new AdventureResult[ moving.size() ] ), destinationShelf ) );
        KoLmafia.updateDisplay( "Display case updated." );

Is there a way to capture an outgoing request, in order to examine it? Otherwise, I don't see how you can test that with our tests...
 

Attachments

  • DisplayCaseManagerRawTypes_2.patch
    6.2 KB · Views: 1

heeheehee

Developer
Staff member
Is there a way to capture an outgoing request, in order to examine it? Otherwise, I don't see how you can test that with our tests...
Not at this time. :/

Traditionally you'd either mock out the corresponding functionality via a library like Mockito, or refactor so you can decouple the nondeterministic I/O part from the result-parsing logic.

As I mentioned, I don't mind the lack of tests if the code is literally just specifying generics, and changing no other logic.
 

heeheehee

Developer
Staff member
(If there are no tests, and it's absolutely not feasible to test with our current framework, then I can still take a look at the patch, but I will take longer to confirm that it's correct.)
 

fredg1

Member
or refactor so you can decouple the nondeterministic I/O part from the result-parsing logic.
The thing is... there isn't any nondeterministic I/O to separate.

What the code was previously doing was transitioning from an array to a List
(making a List the length of the array, and iterating over the array to populate the List)

Now, since the method expects a List, the part is just... removed.
That's it, the part that could previously be separated is now... nothing :|
 

heeheehee

Developer
Staff member
The thing is... there isn't any nondeterministic I/O to separate.
When I say non-deterministic I/O, I mean the running of the DisplayCaseRequest, since that isn't guaranteed to give you reproducible results. (for instance, if you lose internet connection in the middle, you could get an IOException.)
 
Top