File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change 88 * Created by mtumilowicz on 2018-11-30.
99 */
1010@ Value
11- public class Resource implements AutoCloseable {
11+ class Resource implements AutoCloseable {
1212 private Resource (String param ) {
1313 System .out .println ("create" );
1414 }
1515
16- public void op1 () {
16+ void op1 () {
1717 System .out .println ("op1" );
1818 }
1919
20- public void op2 () {
20+ void op2 () {
2121 System .out .println ("op2" );
2222 }
2323
24- public static void use (String param , Consumer <Resource > block ) {
24+ static void use (String param , Consumer <Resource > block ) {
2525 try (final var resource = new Resource (param )) {
2626 block .accept (resource );
2727 }
Original file line number Diff line number Diff line change @@ -7,12 +7,9 @@ import spock.lang.Specification
77 */
88class ResourceTest extends Specification {
99 def " test use" () {
10- given :
11-
12- when :
1310 Resource . use(" param" , {resource -> resource. op1(); resource. op2()})
1411
15- then :
16- 1
12+ expect :
13+ 1 == 1
1714 }
1815}
You can’t perform that action at this time.
0 commit comments