<commit_before>/*
 * Orika - simpler, better and faster Java bean mapping
 *
 * Copyright (C) 2011-2013 Orika authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ma.glasnost.orika.test.community;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.MappingContext;
import ma.glasnost.orika.ObjectFactory;
import ma.glasnost.orika.impl.ConfigurableMapper;

import org.junit.Test;


public class Issue68TestCase {

	@Test
	public void testSimpleReverceCase() {
		ConfigurableMapper mapper = new ConfigurableMapper() {
			@Override
			public void configure(MapperFactory mapperFactory) {
				mapperFactory.classMap(InvoiceItem.class, InvoiceItemVO.class).byDefault().register();
				mapperFactory.classMap(ProjectItem.class, ProjectItemVO.class).byDefault().register();
				mapperFactory.classMap(Project.class, ProjectVO.class).byDefault().register();			
			}

		};

		ProjectVO projectVO = new ProjectVO();
		ProjectItemVO projectItemVO = new ProjectItemVO();
		InvoiceItemVO invoiceitemVO = new InvoiceItemVO();

		projectItemVO.project = projectVO;
		invoiceitemVO.project = projectVO;

		projectVO.getProjectItems().add(projectItemVO);
		projectVO.name = "Great project";
		projectItemVO.getInvoiceItems().add(invoiceitemVO);

		invoiceitemVO.getProjectItems().add(projectItemVO);

		InvoiceItemProxy invoiceItemProxy = BeanFactory
				.createInvoiceItemProxy();
		mapper.map(invoiceitemVO, invoiceItemProxy);


	}

	public static class BeanFactory {
		public static ProjectProxy createProjectProxy() {
			return new Project();
		}

		public static ProjectItemProxy createProjectItemProxy() {
			return new ProjectItem();
		}

		public static InvoiceItemProxy createInvoiceItemProxy() {
			return new InvoiceItem();
		}
	}

	public static interface ProjectProxy {

		void setProjectItems(Set<ProjectItemProxy> projectItems);
<commit_msg>Add missing assertions to TestCase<commit_after>/*
 * Orika - simpler, better and faster Java bean mapping
 *
 * Copyright (C) 2011-2013 Orika authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ma.glasnost.orika.test.community;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.MappingContext;
import ma.glasnost.orika.ObjectFactory;
import ma.glasnost.orika.impl.ConfigurableMapper;

import org.junit.Test;


public class Issue68TestCase {

	@Test
	public void testSimpleReverceCase() {
		ConfigurableMapper mapper = new ConfigurableMapper() {
			@Override
			public void configure(MapperFactory mapperFactory) {
				mapperFactory.classMap(InvoiceItem.class, InvoiceItemVO.class).byDefault().register();
				mapperFactory.classMap(ProjectItem.class, ProjectItemVO.class).byDefault().register();
				mapperFactory.classMap(Project.class, ProjectVO.class).byDefault().register();			
			}

		};

		ProjectVO projectVO = new ProjectVO();
		ProjectItemVO projectItemVO = new ProjectItemVO();
		InvoiceItemVO invoiceitemVO = new InvoiceItemVO();

		projectItemVO.project = projectVO;
		invoiceitemVO.project = projectVO;

		projectVO.getProjectItems().add(projectItemVO);
		projectVO.name = "Great project";
		projectItemVO.getInvoiceItems().add(invoiceitemVO);

		invoiceitemVO.getProjectItems().add(projectItemVO);

        InvoiceItemProxy invoiceItemProxy = BeanFactory.createInvoiceItemProxy();
		mapper.map(invoiceitemVO, invoiceItemProxy);

        ProjectProxy projectProxy = BeanFactory.createProjectProxy();
        mapper.map(projectVO, projectProxy);

        assertThat(projectVO.getName(), is(projectProxy.getName()));
        assertThat(projectVO.getProjectItems(), hasSize(projectProxy.getProjectItems().size()));
	}

	public static class BeanFactory {
		public static ProjectProxy createProjectProxy() {
			return new Project();
		}

		public static ProjectItemProxy createProjectItemProxy() {
			return new ProjectItem();
		}

		public static InvoiceItemProxy createInvoiceItemProxy() {
			return new InvoiceItem();
		}
	}

	public static interface ProjectProxy {

		void setProjectItems(Set<ProjectItemProxy> projectItems);

{'fraction_non_alphanumeric': 0.09279312920089619, 'fraction_numerical': 0.005227781926811053, 'mean_word_length': 4.822826086956522, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6616717', 'n_tokens_mistral': 1627, 'n_tokens_neox': 1480, 'n_words': 405}