package com.langpath.mongo.command;

import com.langpath.mongo.model.User;
import com.langpath.mongo.model.WordGroup;
import com.model_old.enums.Role;
import org.junit.Ignore;
import org.junit.Test;

import java.util.HashMap;
import java.util.Optional;

import static org.junit.Assert.assertEquals;

/**
 * Created by root on 14.10.16.
 */
public class FindWorstAnsweredGroupTest {

    private FindWorstAnsweredGroup command = new FindWorstAnsweredGroup();

    @Test
    @Ignore
    public void shouldNotFindUser() {
        Optional<WordGroup> result = command.findWorstAnsweredGroup(null);

        assertEquals(Optional.empty(), result);
    }

    @Test
    public void shouldNotFindGroupForUser() {
        Optional<WordGroup> result = command.findWorstAnsweredGroup(userWithNoGroups());

        assertEquals(Optional.empty(), result);
    }

    @Test
    public void shouldFindGroupForUser() {
        Optional<WordGroup> result = command.findWorstAnsweredGroup(userWithGroups());

        assertEquals(true, result.isPresent());
    }

    @Test
    public void shouldFindWorstGroupUser() {
        Optional<WordGroup> result = command.findWorstAnsweredGroup(userWithCollectionGroups());

        assertEquals(true, result.isPresent());
        assertEquals("test_02", result.get().getId());
    }

    private User userWithCollectionGroups() {
        WordGroup wordGroup = WordGroup.builder()
                .id("test_02")
                .positiveAnswers(-1L).build();
        return userWithGroups().addWordGroup(wordGroup);
    }

    private User userWithGroups() {
        WordGroup wordGroup = WordGroup.builder()
                .id("test_01")
                .positiveAnswers(1L).build();
        return userWithNoGroups().addWordGroup(wordGroup);
    }

    private User userWithNoGroups() {
        return User.builder()
                .nick("Steven_007")
                .email("steven.test@email.com")
                .firstName("Steven")
                .lastName("Test")
                .password("PWD")
                .role(Role.STUDENT)
                .wordGroups(new HashMap<>())
                .build();
    }

}
@@ -148,33 +148,8 @@
 le;%0A
-import org.junit.Ignore;%0A
 impo
@@ -431,199 +431,8 @@
 );%0A%0A
-    @Test%0A    @Ignore%0A    public void shouldNotFindUser() %7B%0A        Optional%3CWordGroup%3E result = command.findWorstAnsweredGroup(null);%0A%0A        assertEquals(Optional.empty(), result);%0A    %7D%0A%0A
     

Remove unused test