Skip to content

Commit

Permalink
Add test for SteamWebApiInterface.
Browse files Browse the repository at this point in the history
  • Loading branch information
lpradel committed Apr 10, 2015
1 parent f4c3347 commit f5c7198
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
Expand Up @@ -30,6 +30,11 @@ private SteamWebApiInterface(String apiInterface) {
public static SteamWebApiInterface getInterfaceForMethod(
SteamWebApiInterfaceMethod interfaceMethod) {

if (interfaceMethod == null) {
throw new IllegalArgumentException(
"Unsupported Web API Interface method!");
}

switch (interfaceMethod) {

case GET_FRIEND_LIST:
Expand Down
@@ -0,0 +1,60 @@
package com.lukaspradel.steamapi.webapi.core;

import static org.testng.Assert.assertEquals;

import org.testng.annotations.Test;

import com.lukaspradel.steamapi.BaseTest;

public class SteamWebApiInterfaceTest extends BaseTest {

@Test(expectedExceptions = IllegalArgumentException.class)
public void testGetInterfaceMethodError() {

SteamWebApiInterface.getInterfaceForMethod(null);
}

@Test
public void testGetInterfaceMethod() {

assertEquals(
SteamWebApiInterface
.getInterfaceForMethod(SteamWebApiInterfaceMethod.GET_FRIEND_LIST),
SteamWebApiInterface.I_STEAM_USER);

assertEquals(
SteamWebApiInterface
.getInterfaceForMethod(SteamWebApiInterfaceMethod.GET_GLOBAL_ACHIEVEMENT_PERCENTAGES_FOR_APP),
SteamWebApiInterface.I_STEAM_USER_STATS);

assertEquals(
SteamWebApiInterface
.getInterfaceForMethod(SteamWebApiInterfaceMethod.GET_NEWS_FOR_APP),
SteamWebApiInterface.I_STEAM_NEWS);

assertEquals(
SteamWebApiInterface
.getInterfaceForMethod(SteamWebApiInterfaceMethod.GET_OWNED_GAMES),
SteamWebApiInterface.I_PLAYER_SERVICE);

assertEquals(
SteamWebApiInterface
.getInterfaceForMethod(SteamWebApiInterfaceMethod.GET_PLAYER_SUMMARIES),
SteamWebApiInterface.I_STEAM_USER);

assertEquals(
SteamWebApiInterface
.getInterfaceForMethod(SteamWebApiInterfaceMethod.GET_RECENTLY_PLAYED_GAMES),
SteamWebApiInterface.I_PLAYER_SERVICE);

assertEquals(
SteamWebApiInterface
.getInterfaceForMethod(SteamWebApiInterfaceMethod.GET_USER_STATS_FOR_GAME),
SteamWebApiInterface.I_STEAM_USER_STATS);

assertEquals(
SteamWebApiInterface
.getInterfaceForMethod(SteamWebApiInterfaceMethod.IS_PLAYING_SHARED_GAME),
SteamWebApiInterface.I_PLAYER_SERVICE);
}
}

0 comments on commit f5c7198

Please sign in to comment.