@@ -0,0 +1,2241 @@
+/*%0A * Copyright (C) 2015 Y.K. Chan%0A *%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU General Public License as published by%0A * the Free Software Foundation, either version 3 of the License, or%0A * (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU General Public License for more details.%0A *%0A * You should have received a copy of the GNU General Public License%0A * along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0A%0Apackage jacobi.core.facade;%0A%0Aimport jacobi.api.annotations.Facade;%0Aimport jacobi.api.annotations.Implementation;%0Aimport java.util.function.Supplier;%0Aimport org.junit.Assert;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.ExpectedException;%0A%0A/**%0A *%0A * @author Y.K. Chan%0A */%0Apublic class FacadeProxyTest %7B%0A    %0A    @Rule%0A    public ExpectedException expected;%0A%0A    public FacadeProxyTest() %7B%0A        this.expected = ExpectedException.none();%0A    %7D%0A    %0A    @Test%0A    public void testNormalFluent() %7B%0A        TestFluentInterface facade = FacadeProxy.of(TestFluentInterface.class, %22I am a string%22);%0A        Assert.assertEquals(new DoSthImpl().compute(%22I am a string%22, 0), facade.doSth(0).get());%0A    %7D%0A    %0A    @Test%0A    public void testFluentWrongSupplier() %7B%0A        this.expected.expect(RuntimeException.class);%0A        TestFluentWrongSupplier facade = FacadeProxy.of(TestFluentWrongSupplier.class, %22I am a string%22);%0A    %7D%0A    %0A    @Facade(String.class)%0A    public interface TestFluentInterface extends Supplier%3CString%3E %7B%0A        %0A        @Implementation(DoSthImpl.class)%0A        public TestFluentInterface doSth(int i);%0A        %0A    %7D%0A    %0A    @Facade(String.class)%0A    public interface TestFluentWrongSupplier extends Supplier%3CInteger%3E %7B%0A        %0A        @Implementation(DoSthImpl.class)%0A        public TestFluentInterface doSth(int i);%0A        %0A    %7D%0A%0A    public static class DoSthImpl %7B%0A        %0A        public String compute(String str, int i) %7B%0A            return %22String = %22 + str + %22, i = %22 + i;%0A        %7D%0A        %0A    %7D%0A%7D%0A

Support fluent facade