Newer
Older
DesignCraft / src / test / java / parser / PatternTest.java
package parser;

import designPatternExtensions.designPattern.*;
import generators.ASTGenerator;
import org.junit.jupiter.api.Test;

public class PatternTest {

    @Test void abstractFactory() throws Exception { run(new AbstractFactory()); }
    @Test void adapter() throws Exception { run(new Adapter()); }
    @Test void bridge() throws Exception { run(new Bridge()); }
    @Test void builder() throws Exception { run(new Builder()); }
//    @Test void chainOfResponsibility() throws Exception { run(new ChainOfResponsibility()); }
    @Test void command() throws Exception { run(new Command()); }
    @Test void decorator() throws Exception { run(new Decorator()); }
//    @Test void facade() throws Exception { run(new Facade()); }
//    @Test void factoryMethod() throws Exception { run(new FactoryMethod()); }
//    @Test void interpreter() throws Exception { run(new Interpreter()); }
    @Test void iterator() throws Exception { run(new Iterator()); }
//    @Test void mediator() throws Exception { run(new Mediator()); }
    @Test void memento() throws Exception { run(new Memento()); }
    @Test void observer() throws Exception { run(new Observer()); }
    @Test void prototype() throws Exception { run(new Prototype()); }
    @Test void proxy() throws Exception { run(new Proxy()); }
    @Test void singleton() throws Exception { run(new Singleton()); }
    @Test void state() throws Exception { run(new State()); }
    @Test void strategy() throws Exception { run(new Strategy()); }
    @Test void templateMethod() throws Exception { run(new TemplateMethod()); }
    @Test void visitor() throws Exception { run(new Visitor()); }

    private void run(DesignPattern pattern) throws Exception {
        System.out.println(pattern.getClass().getSimpleName());
        System.out.println(ASTGenerator.generate(pattern.create()));
    }
}