Package tests

Source Code of tests.OSXorWindowsFactory

package tests;

import abstraction.components.Button;
import abstraction.factory.GUIFactory;
import abstraction.factory.GUIFactoryChoice;

* @author J Paul Gibson
* @version 1
* Check that different factories can be used but only 1 factory object of each type is ever created
Using factory p_factory.WindowsFactory@1fb8ee3 to construct aButton
WindowsButton: Push a
Using factory p_factory.OSXFactory@14318bb to construct bButton
OSXButton: Push b
Using factory p_factory.WindowsFactory@1fb8ee3 to construct cButton
WindowsButton: Push c
public class OSXorWindowsFactory {

  public static void main(String[] args) {

    GUIFactory aFactory = GUIFactoryChoice.getFactory();
    System.out.println("Using factory " + aFactory
        + " to construct aButton");
    Button aButton = aFactory.createButton();
    aButton.setCaption("Push a");

    GUIFactory bFactory = GUIFactoryChoice.getFactory();
    System.out.println("\nUsing factory " + bFactory
        + " to construct bButton");
    Button bButton = bFactory.createButton();
    bButton.setCaption("Push b");

    GUIFactory cFactory = GUIFactoryChoice.getFactory();
    System.out.println("\nUsing factory " + cFactory
        + " to construct cButton");
    Button cButton = cFactory.createButton();
    cButton.setCaption("Push c");


Related Classes of tests.OSXorWindowsFactory

Copyright © 2018 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