### Question:
TokenService { public static Token create(final Context context, final Token token) throws NetLicensingException { CheckUtils.paramNotNull(token, "token"); return NetLicensingService.getInstance().post(context, Constants.Token.ENDPOINT_PATH, token.asRequestForm(), Token.class); }  static Token get(final Context context, final String number); static Page<Token> list(final Context context, final String filter); static Token create(final Context context, final Token token); static void delete(final Context context, final String number);  }### Answer:
@Test public void testCreateEmpty() throws Exception { final Token createdToken = TokenService.create(context, new TokenImpl()); assertNotNull(createdToken); assertNotNull(createdToken.getNumber()); assertEquals(true, createdToken.getActive()); assertNotNull(createdToken.getExpirationTime()); assertEquals(TokenType.DEFAULT, createdToken.getTokenType()); assertEquals("VDEMO", createdToken.getVendorNumber()); }
@Test public void testCreateEmptyApiKeyToken() throws Exception { final TokenImpl newToken = new TokenImpl(); newToken.setTokenType(TokenType.APIKEY); final Token createdToken = TokenService.create(context, newToken); assertNotNull(createdToken); assertNotNull(createdToken.getNumber()); assertEquals(true, createdToken.getActive()); assertNull(createdToken.getExpirationTime()); assertEquals(TokenType.APIKEY, createdToken.getTokenType()); assertEquals("VDEMO", createdToken.getVendorNumber()); }
@Test public void testCreateShopTokenWithoutLicenseeNumber() throws Exception { final TokenImpl newToken = new TokenImpl(); newToken.setTokenType(TokenType.SHOP); thrown.expect(ServiceException.class); thrown.expectMessage("MalformedRequestException: Malformed token request, TokenValidation: Property 'licenseeNumber' not found"); TokenService.create(context, newToken); }