Package helloworld.creational.factory_method

Source Code of helloworld.creational.factory_method.FactoryMethodHelloWorldFactoryTest

package helloworld.creational.factory_method;

import helloworld.HelloWorld;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

/**
* @author yihua.huang@dianping.com
*/
public class FactoryMethodHelloWorldFactoryTest {

    @Test
    public void testFactoryMethodHelloWorldFactory(){
        HelloWorldFactory helloWorldFactory = new HelloWorldFactory();
        HelloWorld helloWorld = helloWorldFactory.createHelloWorld();
        assertThat(helloWorld.helloWorld(),is("Hello World!"));
        FactoryMethodHelloWorldFactory factoryMethodHelloWorldFactory = new FactoryMethodHelloWorldFactory();
        helloWorld = factoryMethodHelloWorldFactory.createHelloWorld();
        assertThat(helloWorld.helloWorld(),is("Hello Factory Method!"));
    }
}
TOP

Related Classes of helloworld.creational.factory_method.FactoryMethodHelloWorldFactoryTest

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.