Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TestGroupGetInfo extends ApiTestBase {

/**
* Пример теста на метод group.getInfo
*/

@Test
public void testGroupGetInfoExample() throws ApiException {
LOGGER.info("Получим данные об одной группе с помощью метода group.getInfo");
Expand All @@ -48,5 +48,21 @@ public void testGroupGetInfoExample() throws ApiException {
GroupBean groupBean = groupBeans[0];
Assert.assertEquals("Неверный id группы", GROUP_ID, groupBean.getUid());
Assert.assertEquals("Неверное название группы", GROUP_NAME, groupBean.getName());
}
}*/

@Test
public void testGroupGetInfoMy() throws ApiException {
LOGGER.info("Получим данные об одной группе с помощью метода group.getInfo");
bindDefaultUserSession();

GroupBean[] groupBeans = okApi.getGroupService().getGroupInfo(new String[]{GROUP_ID}, FIELDS);

GroupBean groupBean = groupBeans[0];
Assert.assertNotNull("Нет участников", groupBean.getMembersCount());
Assert.assertEquals("Невернок описание","ВСЁ ДЛЯ ХОРОШЕГО НАСТРОЕНИЯ", groupBean.getDescription());
Assert.assertNotEquals("Несовпадение",groupBean.getName(),groupBean.getShortname());
Assert.assertEquals("Неверный id группы", GROUP_ID, groupBean.getUid());
Assert.assertFalse("Нет описания", groupBean.getDescription().isEmpty());
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class TestGroupGetUserGroupsV2 extends ApiTestBase {

/**
* Пример теста на метод group.getUserGroupsV2
*/

@Test
public void testGroupGetUserGroupsV2Example() throws ApiException {
LOGGER.info("Получим данные о группах пользвоателя с помощью метода group.getUserGroupsV2");
Expand All @@ -28,4 +28,20 @@ public void testGroupGetUserGroupsV2Example() throws ApiException {
LOGGER.info("Проверим, что в ответе есть группы");
Assert.assertFalse("Пустой список групп", CollectionUtils.isEmpty(groupGetUserGroupsV2Response.getGroups()));
}

* Мои тесты group.getUserGroupsV2
*/

@Test
public void testGroupGetUserGroupsV2My() throws ApiException {
LOGGER.info("Получим данные о группах пользвоателя с помощью метода group.getUserGroupsV2");
bindDefaultUserSession();

GroupGetUserGroupsV2Response groupGetUserGroupsV2Response = okApi.getGroupService().getUserGroupsV2();
LOGGER.info("Проверим, что в ответе есть группы");
Assert.assertEquals("Совпадает userId","561744237296",groupGetUserGroupsV2Response.getGroups().get(1).getUserId());
Assert.assertNotNull("Количество групп не 0",groupGetUserGroupsV2Response.getGroups().size());
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size коллекции не может быть null.
Можно саму коллекцию проверить на то, что она не null

Assert.assertFalse("Пустой список групп",groupGetUserGroupsV2Response.getGroups().isEmpty());
Assert.assertTrue("Содержит инофрмацию Anchor",groupGetUserGroupsV2Response.getGroups().contains(groupGetUserGroupsV2Response.getAnchor()));
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это очень странная проверка, смысл которой от меня скрыт. Ты проверяешь, что в списке групп есть служебный параметр anchor, которого в списке групп никогда не будет

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class TestUsersGetInfoBy extends ApiTestBase {

/**
* Пример теста на метод users.getInfoBy
*/

@Test
public void testUsersGetInfoByExample() throws ApiException {
LOGGER.info("Получим данные о другом пользователе с помощью метода users.getInfoBy");
Expand All @@ -34,5 +34,21 @@ public void testUsersGetInfoByExample() throws ApiException {
Assert.assertNotNull("Не получили информацию о пользователе", userBean);
Assert.assertEquals("Неверный ID пользователя", USER_ID, userBean.getUid());
Assert.assertEquals("Неверное имя пользователя", USER_NAME, userBean.getName());
}*/
@Test
public void testUsersGetInfoByMe() throws ApiException {
LOGGER.info("Получим данные о другом пользователе с помощью метода users.getInfoBy");
bindDefaultUserSession();

UsersGetInfoByResponse getInfoByResponse = okApi.getUserService().getInfoBy(USER_ID, FIELDS);

LOGGER.info("Проверим, что получили верные данные");

UserBean userBean = getInfoByResponse.getUser();
Assert.assertNotNull(userBean);
Assert.assertFalse("Не получили информацию об имени", userBean.getName().isEmpty());
Assert.assertEquals("Неверный имя пользователя", "Юрий Дудь", userBean.getName());
Assert.assertNotNull("Не получили информацию о e-mail", userBean.getEmail());
Assert.assertTrue("Старше 18 лет", userBean.getAge()>=18);
}
}
12 changes: 6 additions & 6 deletions src/test/resources/project.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# OK API settings
#OK API settings
api.server.url=https://api.ok.ru/fb.do
api.app.public.key=
api.app.secret.key=
api.app.public.key=CBAMKNHMEBABABABA
api.app.secret.key=1389F636CEE9435FAFDEA07F
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Секретные ключи от своего приложения лучше не палить :)


#User session settings
user.session.access.token=
user.session.secret.key=
user.session.access.token=tkn1Iqr1L3RuERQCROQ7w1Yk1vcDQwOvWYkSL27HlPmdpvg2eHUFWRSvCF4cGp7MLGf4j0
user.session.secret.key=34189d0161cd7e013c3a37640b0fc76c

# HttpClient settings
#HttpClient settings
http.client.timeout=15000

31 changes: 31 additions & 0 deletions techno-atom-sample-2.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Что-то ты не то закоммитила. Тесты где? :)

<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-all:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-context:4.1.5.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-aop:4.1.5.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-beans:4.1.5.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-core:4.1.5.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-expression:4.1.5.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:4.1.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.3.1" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:18.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.4.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.1" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.7" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.2" level="project" />
</component>
</module>