Package ar.com.dgarcia.java_verbs.api

Examples of ar.com.dgarcia.java_verbs.api.Verb.apply()


        describe("a piece of behavior", ()->{

            Verb verb = Verbs.in("tests").asFunction("name", () -> "John Smith");

            it("is a function defined in a namespace", () -> {
                String returnedValue = verb.apply();

                assertThat(returnedValue).isEqualTo("John Smith");
            });

            it("that can be used to implement a method", () -> {
View Full Code Here


            Verb verb = Verbs.in("tests").asFunction("salute", () -> "Hello");


            it("can be re-defined in runtime", ()->{
                assertThat(verb.<String>apply()).isEqualTo("Hello");

                Verbs.in("tests").asFunction("salute", () -> "Bye");

                assertThat(verb.<String>apply()).isEqualTo("Bye");
            });
View Full Code Here

            it("can be re-defined in runtime", ()->{
                assertThat(verb.<String>apply()).isEqualTo("Hello");

                Verbs.in("tests").asFunction("salute", () -> "Bye");

                assertThat(verb.<String>apply()).isEqualTo("Bye");
            });

        });

    }
View Full Code Here

        describe("a verb with no return value", () -> {

            it("and no argument", () -> {
                Verb verb = Verbs.in("test").asAction("test", () -> context().operation().operationWithNoReturn());

                verb.apply();

                verify(context().operation()).operationWithNoReturn();
            });

            it("1 argument", () -> {
View Full Code Here

            });

            it("1 argument", () -> {
                Verb verb = Verbs.in("test").asAction("test", (first) -> context().operation().operationWithNoReturn(first));

                verb.apply("1");

                verify(context().operation()).operationWithNoReturn("1");
            });

            it("2 arguments", () -> {
View Full Code Here

            });

            it("2 arguments", () -> {
                Verb verb = Verbs.in("test").asAction("test", (first, second) -> context().operation().operationWithNoReturn(first, second));

                verb.apply("1", "2");

                verify(context().operation()).operationWithNoReturn("1", "2");
            });

            it("3 arguments", () -> {
View Full Code Here

            });

            it("3 arguments", () -> {
                Verb verb = Verbs.in("test").asAction("test", (first, second, third) -> context().operation().operationWithNoReturn(first, second, third));

                verb.apply("1", "2", "3");

                verify(context().operation()).operationWithNoReturn("1", "2", "3");
            });

            it("4 arguments", () -> {
View Full Code Here

            });

            it("4 arguments", () -> {
                Verb verb = Verbs.in("test").asAction("test", (first, second, third, fourth, extra) -> context().operation().operationWithNoReturn(first, second, third, fourth));

                verb.apply("1", "2", "3", "4");

                verify(context().operation()).operationWithNoReturn("1", "2", "3", "4");
            });

            it("5 or more arguments", () -> {
View Full Code Here

            });

            it("5 or more arguments", () -> {
                Verb verb = Verbs.in("test").asAction("test", (first, second, third, fourth, extra) -> context().operation().operationWithNoReturn(first, second, third, fourth, extra[0]));

                verb.apply("1", "2", "3", "4", "5");

                verify(context().operation()).operationWithNoReturn("1", "2", "3", "4", "5");
            });

        });
View Full Code Here

        describe("a verb with return value", ()->{

            it("and no argument", ()->{
                Verb verb = Verbs.in("test").asFunction("test", () -> context().operation().operationWithReturn());

                verb.apply();

                verify(context().operation()).operationWithReturn();
            });

            it("1 argument", ()->{
View Full Code Here

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.