/*
* The MIT License (MIT)	 
*
* Copyright (c) 2014 LeanIX GmbH
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package net.leanix.api.test;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import net.leanix.api.UsersApi;
import net.leanix.api.models.User;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

public class UsersApiTest extends TestBase
{
	final Logger logger = LoggerFactory.getLogger(UsersApiTest.class);
	
	protected UsersApi getApi() throws Exception
	{
		UsersApi api = getUsersApi();
		return api;
	}
	
	@Test
	public void testGetList() throws Exception
	{	
		List<User> users = this.getApi().getUsers(false);
		
		// Only 1 user should be in the database after the workspace was created
		assertTrue(users.size() == 1);
	}
	
	@Test
	public void testGet() throws Exception
	{
		List<User> users = this.getApi().getUsers(false);
		
		// We expect to have at least 1 user
		assertTrue(users.size() > 0);
		User curUser = users.get(0);
		
		User user = this.getApi().getUser(curUser.getID(), false);
		// We should have at least one user
		assertNotNull(user);
	}

}

@@ -1170,24 +1170,70 @@
 pi.test;%0D%0A%0D%0A
+import static org.junit.Assert.assertEquals;%0D%0A
 import stati
@@ -1267,16 +1267,16 @@
 tNull;%0D%0A
-
 import s
@@ -1411,67 +1411,8 @@
 st;%0D
-%0Aimport org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory;%0D
 %0A%0D%0Ai
@@ -1487,80 +1487,8 @@
 %0A%7B%0D%0A
-%09final Logger logger = LoggerFactory.getLogger(UsersApiTest.class);%0D%0A%09%0D%0A
 %09pro
@@ -1780,37 +1780,42 @@
 reated%0D%0A%09%09assert
-True(
+Equals(1, 
 users.size() == 
@@ -1814,13 +1814,8 @@
 ze()
- == 1
 );%0D%0A

improve assertion in test for better diagnose of CI build test failure