@Test public void interfaceCode() { final String name = "Cat"; MatcherAssert.assertThat( new JavaInterface( name, new StickyList<>() ).code(), new InputHasContent( Matchers.stringContainsInOrder( new StickyList<>( "public", "interface", name, "{", "}" ) ) ) ); }
@Override public Input code() { return new InputOf( new FormattedText( "%s\n\npublic interface %s {\n %s\n}\n", "package eo;", this.name, new UncheckedText( new JoinedText( "\n ", new Mapped<>( mtd -> new UncheckedText( new FormattedText("%s;", mtd.java()) ).asString(), this.methods ) ) ).asString().replace("\n", "\n ") ) ); }
JavaInterface implements JavaFile { @Override public Input code() { return new InputOf( new FormattedText( "%s\n\npublic interface %s {\n %s\n}\n", "package eo;", this.name, new UncheckedText( new JoinedText( "\n ", new Mapped<>( mtd -> new UncheckedText( new FormattedText("%s;", mtd.java()) ).asString(), this.methods ) ) ).asString().replace("\n", "\n ") ) ); } }
JavaInterface implements JavaFile { @Override public Input code() { return new InputOf( new FormattedText( "%s\n\npublic interface %s {\n %s\n}\n", "package eo;", this.name, new UncheckedText( new JoinedText( "\n ", new Mapped<>( mtd -> new UncheckedText( new FormattedText("%s;", mtd.java()) ).asString(), this.methods ) ) ).asString().replace("\n", "\n ") ) ); } JavaInterface(final String name, final Collection<Method> methods); }
JavaInterface implements JavaFile { @Override public Input code() { return new InputOf( new FormattedText( "%s\n\npublic interface %s {\n %s\n}\n", "package eo;", this.name, new UncheckedText( new JoinedText( "\n ", new Mapped<>( mtd -> new UncheckedText( new FormattedText("%s;", mtd.java()) ).asString(), this.methods ) ) ).asString().replace("\n", "\n ") ) ); } JavaInterface(final String name, final Collection<Method> methods); @Override String path(); @Override Input code(); }
JavaInterface implements JavaFile { @Override public Input code() { return new InputOf( new FormattedText( "%s\n\npublic interface %s {\n %s\n}\n", "package eo;", this.name, new UncheckedText( new JoinedText( "\n ", new Mapped<>( mtd -> new UncheckedText( new FormattedText("%s;", mtd.java()) ).asString(), this.methods ) ) ).asString().replace("\n", "\n ") ) ); } JavaInterface(final String name, final Collection<Method> methods); @Override String path(); @Override Input code();  }