<commit_before>package at.fhj.swd14.pse.community;

import at.fhj.swd14.pse.user.User;
import at.fhj.swd14.pse.user.UserDto;
import org.junit.Before;

import java.sql.Date;
import java.util.ArrayList;
import java.util.List;


public class CommunityConverterTest {

    Community community;
    CommunityDto communityDto;
    UserDto userDao;
    User user;
    boolean state;
    User user_author;
    UserDto userdto_author;
    Date date = new Date(0);
    String description = "Communitytest";
    String name = "<NAME>";

    @Before
    public void setup() {
        this.userdto_author = this.createUserDto((long) 1, "<EMAIL>", "<PASSWORD>", "<PASSWORD>");
        this.user_author = this.createUser((long) 1, "<EMAIL>", "<PASSWORD>", "<PASSWORD>");

        this.createCommunity();
        this.createCommunityDto();
    }

//	@Test
//	public void testCommunityToCommunityDto(){
////		CommunityDto c = CommunityConverter.convert(this.community);
////		CommunityDtoTester.assertEquals(this.communityDto, c);
//	}


    private void createCommunityDto() {
        this.communityDto = new CommunityDto((long) 1);
        this.communityDto.setActiveState(this.state);
        this.communityDto.setAllowedUsers(this.getUserDtoList());
        this.communityDto.setAuthor(this.userdto_author);
        this.communityDto.setCreateTime(this.date);
        this.communityDto.setDescription(this.description);
        this.communityDto.setName(this.name);
        this.communityDto.setPendingUsers(this.getUserDtoList());
        this.communityDto.setPublicState(this.state);

    }

    private void createCommunity() {
//        this.community = new Community();
//        this.community.setId((long) 1);
//        this.community.setAllowedUsers(this.getUserDtoList());
//        this.community.setAuthor(this.user_author);
//        this.community.setName(this.name);
//        this.community.setPublicState(this.state);

    }

    private List<User> getUserList() {

        List<User> user = new ArrayList<>();
        user.add(this.createUser((long) 1, "<EMAIL>", "<PASSWORD>", "salt"));
        user.add(this.createUser((long) 2, "<EMAIL>", "<PASSWORD>", "salt"));

        return user;
    }

    private List<UserDto> getUserDtoList() {

        List<UserDto> userDto = new ArrayList<>();
        userDto.add(this.createUserDto((long) 1, "<EMAIL>", "<PASSWORD>", "salt"));
        userDto.add(this.createUserDto((long) 2, "<EMAIL>", "<PASSWORD>", "salt"));

        return userDto;
    }


    private User createUse(long id, String mail, String password, String salt) {
        User u = new User();<commit_msg>Add: CommunityConverterTest<commit_after>package at.fhj.swd14.pse.community;

import at.fhj.swd14.pse.user.User;
import at.fhj.swd14.pse.user.UserDto;
import org.junit.Before;
import org.junit.Test;

import java.sql.Date;
import java.util.ArrayList;
import java.util.List;


public class CommunityConverterTest {

    Community community;
    CommunityDto communityDto;
    UserDto userDao;
    User user;
    boolean state;
    User user_author;
    UserDto userdto_author;
    Date date = new Date(0);
    String description = "Communitytest";
    String name = "<NAME>";

    @Before
    public void setup() {
        this.userdto_author = this.createUserDto((long) 1, "<EMAIL>", "password_author", "salt");
        this.user_author = this.createUser((long) 1, "<EMAIL>", "<PASSWORD>author", "salt");

        this.createCommunity();
        this.createCommunityDto();
    }

	@Test
	public void testCommunityToCommunityDto(){
		CommunityDto c = CommunityConverter.convert(this.community);
		CommunityAssert.assertEquals(this.communityDto, c);
	}


    private void createCommunityDto() {
        this.communityDto = new CommunityDto((long) 1);
        this.communityDto.setActiveState(this.state);
        this.communityDto.setAllowedUsers(this.getUserDtoList());
        this.communityDto.setAuthor(this.userdto_author);
        this.communityDto.setCreateTime(this.date);
        this.communityDto.setDescription(this.description);
        this.communityDto.setName(this.name);
        this.communityDto.setPendingUsers(this.getUserDtoList());
        this.communityDto.setPublicState(this.state);

    }

    private void createCommunity() {
        this.community = new Community();
        this.community.setId((long) 1);
        this.community.setAllowedUsers(this.getUser());
        this.community.setAuthor(this.user_author);
        this.community.setName(this.name);
        this.community.setPublicState(this.state);

    }

    private List<User> getUserList() {

        List<User> user = new ArrayList<>();
        user.add(this.createUser((long) 1, "<EMAIL>", "<PASSWORD>", "salt"));
        user.add(this.createUser((long) 2, "<EMAIL>", "password_2", "salt"));

        return user;
    }

    private List<User> getUser() {

        List<User> userDto = new ArrayList<>();
        userDto.add(this.createUse((long) 1, "<EMAIL>", "<PASSWORD>", "salt"));
        userDto.add(this.createUse((long) 2, "<EMAIL>", "password_2", "salt"));

        return userDto;
    }
    
    private List<UserDto> getUserDtoList() {

        List<UserDto> userDto = new ArrayList<>();
        userDto.add(this.createUserDto((long) 1, "<EMAIL>", "password_1", "salt"));
        userDto.add(this.createUserDto((long) 2, "<EMAIL>", "<PASSWORD>", "<PASSWORD>"));

        return userDto;
    }


    private User createUse(long id, String mail, String password, String salt) {
        User u = new User();
{'fraction_non_alphanumeric': 0.14578051430641073, 'fraction_numerical': 0.006338283230713509, 'mean_word_length': 3.298054474708171, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6991912', 'n_tokens_mistral': 1771, 'n_tokens_neox': 1720, 'n_words': 315}