Package br.com.six2six.fixturefactory

Source Code of br.com.six2six.fixturefactory.FixtureInnerClassTest

package br.com.six2six.fixturefactory;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;

import org.junit.BeforeClass;
import org.junit.Test;

import br.com.six2six.fixturefactory.loader.FixtureFactoryLoader;
import br.com.six2six.fixturefactory.model.Owner;

public class FixtureInnerClassTest {

  @BeforeClass
  public static void setUp() {
    FixtureFactoryLoader.loadTemplates("br.com.six2six.template");
  }
 
  @Test
  public void shouldCreateObjectWithInnerClass() {
    Owner owner = Fixture.from(Owner.class).gimme("valid");
   
    assertNotNull("owner should not be null", owner);
    assertNotNull("owner.inner should not be null", owner.getInner());
   
    assertSame("owner.inner.owner should be same of owner", owner.getInner().getOwner(), owner);
    assertEquals("222", owner.getInner().getId());
  }
 
  @Test
    public void shouldCreateObjectWithInnerClassChainedProperty() {
        Owner owner = Fixture.from(Owner.class).gimme("chained");
       
        assertNotNull("owner should not be null", owner);
        assertNotNull("owner.inner should not be null", owner.getInner());
       
        assertSame("owner.inner.owner should be same of owner", owner.getInner().getOwner(), owner);
        assertEquals("333", owner.getInner().getId());
    }
}
TOP

Related Classes of br.com.six2six.fixturefactory.FixtureInnerClassTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.