http-service: split hiscore service from controller

This commit is contained in:
Adam
2018-01-20 19:11:28 -05:00
parent 6397b1b4b7
commit 4d2c02e81c
5 changed files with 106 additions and 60 deletions

View File

@@ -91,7 +91,7 @@ public class HiscoreServiceTest
{
HiscoreTestService hiscores = new HiscoreTestService(server.url("/"));
HiscoreResult result = hiscores.lookup(HiscoreEndpoint.NORMAL, "zezima");
HiscoreResult result = hiscores.lookupUsername("zezima", HiscoreEndpoint.NORMAL).build();
Assert.assertEquals(50, result.getAttack().getLevel());
Assert.assertEquals(159727L, result.getFishing().getExperience());

View File

@@ -23,17 +23,15 @@
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.http.service.hiscore;
import java.io.IOException;
import net.runelite.http.api.hiscore.HiscoreEndpoint;
import okhttp3.HttpUrl;
import java.io.IOException;
class HiscoreTestService extends HiscoreService
{
private HttpUrl testUrl;
private final HttpUrl testUrl;
HiscoreTestService(HttpUrl testUrl)
{
@@ -41,7 +39,7 @@ class HiscoreTestService extends HiscoreService
}
@Override
HiscoreResultBuilder lookupUsername(String username, HiscoreEndpoint endpoint) throws IOException
public HiscoreResultBuilder lookupUsername(String username, HiscoreEndpoint endpoint) throws IOException
{
return super.lookupUsername(username, testUrl);
}