[Lombok] Adapt format of codegen tests to standard box() style
This commit is contained in:
committed by
teamcity
parent
bc8051ce9b
commit
dcd96932aa
+19
-19
@@ -3,8 +3,9 @@
|
||||
import lombok.*;
|
||||
import lombok.experimental.*;
|
||||
|
||||
@Getter @Setter
|
||||
@Accessors(prefix = {"f", "field"})
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(prefix = { "f", "field" })
|
||||
public class AccessorsTest {
|
||||
// @Accessors
|
||||
private int age = 10;
|
||||
@@ -17,8 +18,9 @@ public class AccessorsTest {
|
||||
@Accessors
|
||||
private Boolean isNonPrimitiveHuman;
|
||||
|
||||
static void test() {
|
||||
val obj = new AccessorsTest();
|
||||
static void test()
|
||||
{
|
||||
val obj = new AccessorsTest ();
|
||||
|
||||
// obj.getAge();
|
||||
// obj.setAge(123);
|
||||
@@ -44,28 +46,26 @@ public class AccessorsTest {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = AccessorsTest()
|
||||
fun box(): String {
|
||||
val obj = AccessorsTest()
|
||||
|
||||
// obj.getAge()
|
||||
// obj.setAge(123)
|
||||
|
||||
obj.getTarget()
|
||||
obj.setTarget(34)
|
||||
obj.getTarget()
|
||||
obj.setTarget(34)
|
||||
|
||||
obj.getValue()
|
||||
obj.setValue("sdf")
|
||||
obj.getValue()
|
||||
obj.setValue("sdf")
|
||||
|
||||
obj.isHuman()
|
||||
obj.setHuman(true)
|
||||
obj.isHuman()
|
||||
obj.setHuman(true)
|
||||
|
||||
obj.isPrefixedBoolean()
|
||||
obj.setPrefixedBoolean(false)
|
||||
obj.isPrefixedBoolean()
|
||||
obj.setPrefixedBoolean(false)
|
||||
|
||||
obj.getIsNonPrimitiveHuman()
|
||||
obj.setIsNonPrimitiveHuman(false)
|
||||
|
||||
}
|
||||
obj.getIsNonPrimitiveHuman()
|
||||
obj.setIsNonPrimitiveHuman(false)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -15,15 +15,13 @@ public class PrefixJava {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
//not generated because doesn't have prefix from class level @Accessors
|
||||
//assertEquals(PrefixJava().propA, "A")
|
||||
//not generated because doesn't have prefix from config
|
||||
//assertEquals(PrefixJava().propC, "C")
|
||||
assertEquals(PrefixJava().propD, "D")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
//not generated because doesn't have prefix from class level @Accessors
|
||||
//assertEquals(PrefixJava().propA, "A")
|
||||
//not generated because doesn't have prefix from config
|
||||
//assertEquals(PrefixJava().propC, "C")
|
||||
assertEquals(PrefixJava().propD, "D")
|
||||
return "OK"
|
||||
}
|
||||
|
||||
//FILE: lombok.config
|
||||
|
||||
+15
-18
@@ -43,30 +43,27 @@ public class AccessorsTest {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = AccessorsTest()
|
||||
fun box(): String {
|
||||
val obj = AccessorsTest()
|
||||
|
||||
// obj.getAge()
|
||||
// obj.setAge(123)
|
||||
// obj.getAge()
|
||||
// obj.setAge(123)
|
||||
|
||||
obj.getTarget()
|
||||
obj.setTarget(34)
|
||||
obj.getTarget()
|
||||
obj.setTarget(34)
|
||||
|
||||
obj.getValue()
|
||||
obj.setValue("sdf")
|
||||
obj.getValue()
|
||||
obj.setValue("sdf")
|
||||
|
||||
obj.isHuman()
|
||||
obj.setHuman(true)
|
||||
obj.isHuman()
|
||||
obj.setHuman(true)
|
||||
|
||||
obj.isPrefixedBoolean()
|
||||
obj.setPrefixedBoolean(false)
|
||||
|
||||
obj.getIsNonPrimitiveHuman()
|
||||
obj.setIsNonPrimitiveHuman(false)
|
||||
|
||||
}
|
||||
obj.isPrefixedBoolean()
|
||||
obj.setPrefixedBoolean(false)
|
||||
|
||||
obj.getIsNonPrimitiveHuman()
|
||||
obj.setIsNonPrimitiveHuman(false)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
//FILE: lombok.config
|
||||
|
||||
+3
-4
@@ -19,8 +19,7 @@ public class ConstructorExample {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val generated = ConstructorExample(12, "sdf", true)
|
||||
}
|
||||
fun box(): String {
|
||||
val generated = ConstructorExample(12, "sdf", true)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -24,9 +24,8 @@ public class ConstructorExample {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val existing: ConstructorExample = ConstructorExample("existing")
|
||||
val generated: ConstructorExample = ConstructorExample.of(45, "234", false)
|
||||
}
|
||||
fun box(): String {
|
||||
val existing: ConstructorExample = ConstructorExample("existing")
|
||||
val generated: ConstructorExample = ConstructorExample.of(45, "234", false)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+20
-21
@@ -79,32 +79,31 @@ class KotlinChildClass : ClashTest() {
|
||||
|
||||
}
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = ClashTest()
|
||||
fun box(): String {
|
||||
val obj = ClashTest()
|
||||
|
||||
obj.getAge()
|
||||
//thats shouldn't work because lombok doesn't generate clashing method
|
||||
obj.getAge()
|
||||
//thats shouldn't work because lombok doesn't generate clashing method
|
||||
// obj.setAge(41)
|
||||
// obj.age = 12
|
||||
val age = obj.age
|
||||
val age = obj.age
|
||||
|
||||
|
||||
obj.getName()
|
||||
obj.setName("Al")
|
||||
val name = obj.name
|
||||
obj.name = "sdf"
|
||||
obj.getName()
|
||||
obj.setName("Al")
|
||||
val name = obj.name
|
||||
obj.name = "sdf"
|
||||
|
||||
obj.isHuman()
|
||||
obj.setHuman(true)
|
||||
obj.isHuman("sdf")
|
||||
val isHuman = obj.isHuman
|
||||
obj.isHuman = false
|
||||
obj.isHuman()
|
||||
obj.setHuman(true)
|
||||
obj.isHuman("sdf")
|
||||
val isHuman = obj.isHuman
|
||||
obj.isHuman = false
|
||||
|
||||
val childObj = KotlinChildClass()
|
||||
childObj.getToOverride()
|
||||
childObj.setToOverride(34)
|
||||
childObj.toOverride
|
||||
childObj.toOverride = 412
|
||||
}
|
||||
val childObj = KotlinChildClass()
|
||||
childObj.getToOverride()
|
||||
childObj.setToOverride(34)
|
||||
childObj.toOverride
|
||||
childObj.toOverride = 412
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+6
-7
@@ -19,13 +19,12 @@ public class GetterTest {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = GetterTest()
|
||||
val ref: GetterTest = obj.name("some").age(34)
|
||||
obj.name()
|
||||
obj.age()
|
||||
}
|
||||
fun box(): String {
|
||||
val obj = GetterTest()
|
||||
val ref: GetterTest = obj.name("some").age(34)
|
||||
obj.name()
|
||||
obj.age()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
//FILE: lombok.config
|
||||
|
||||
@@ -22,13 +22,12 @@ public class GetterTest {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = GetterTest()
|
||||
val ref: GetterTest = obj.fluent(true)
|
||||
obj.name()
|
||||
obj.age()
|
||||
}
|
||||
fun box(): String {
|
||||
val obj = GetterTest()
|
||||
val ref: GetterTest = obj.fluent(true)
|
||||
obj.name()
|
||||
obj.age()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
//FILE: lombok.config
|
||||
|
||||
@@ -15,13 +15,12 @@ public class GetterTest {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = GetterTest()
|
||||
fun box(): String {
|
||||
val obj = GetterTest()
|
||||
|
||||
obj.primitiveBoolean
|
||||
obj.getPrimitiveBoolean()
|
||||
}
|
||||
obj.primitiveBoolean
|
||||
obj.getPrimitiveBoolean()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
//FILE: lombok.config
|
||||
|
||||
+5
-6
@@ -15,13 +15,12 @@ public class GetterTest {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = GetterTest()
|
||||
fun box(): String {
|
||||
val obj = GetterTest()
|
||||
|
||||
obj.primitiveBoolean
|
||||
obj.getPrimitiveBoolean()
|
||||
}
|
||||
obj.primitiveBoolean
|
||||
obj.getPrimitiveBoolean()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
//FILE: lombok.config
|
||||
|
||||
+12
-13
@@ -27,18 +27,17 @@ import lombok.*;
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = DataExample("name")
|
||||
obj.getName()
|
||||
assertEquals(obj.name, "name")
|
||||
obj.getTags()
|
||||
val tags = obj.tags
|
||||
obj.setScore(1.5)
|
||||
assertEquals(obj.score, 1.5)
|
||||
obj.score = 2.5
|
||||
assertEquals(obj.score, 2.5)
|
||||
fun box(): String {
|
||||
val obj = DataExample("name")
|
||||
obj.getName()
|
||||
assertEquals(obj.name, "name")
|
||||
obj.getTags()
|
||||
val tags = obj.tags
|
||||
obj.setScore(1.5)
|
||||
assertEquals(obj.score, 1.5)
|
||||
obj.score = 2.5
|
||||
assertEquals(obj.score, 2.5)
|
||||
|
||||
val ex: DataExample.Exercise<Int> = DataExample.Exercise.of("name", 12)
|
||||
}
|
||||
val ex: DataExample.Exercise<Int> = DataExample.Exercise.of("name", 12)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+9
-9
@@ -26,13 +26,13 @@ public class GenericsTest<A, B> {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = GenericsTest<String, Boolean>()
|
||||
val age: Int = obj.getAge();
|
||||
obj.setFieldA("fooo");
|
||||
val a: String = obj.getFieldA();
|
||||
val b: Boolean? = obj.getFieldB();
|
||||
obj.setFieldC(java.util.HashMap<String, Boolean>());
|
||||
}
|
||||
fun box(): String {
|
||||
val obj = GenericsTest<String, Boolean>()
|
||||
val age: Int = obj.getAge();
|
||||
obj.setFieldA("fooo");
|
||||
val a: String = obj.getFieldA();
|
||||
val b: Boolean? = obj.getFieldB();
|
||||
obj.setFieldC(java.util.HashMap<String, Boolean>());
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -21,9 +21,8 @@ public class ConstructorExample<A, B> {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val generated = ConstructorExample<Long, Boolean>(12, 42L, true)
|
||||
val generatedReq = ConstructorExample<String, Boolean>("234");
|
||||
}
|
||||
fun box(): String {
|
||||
val generated = ConstructorExample<Long, Boolean>(12, 42L, true)
|
||||
val generatedReq = ConstructorExample<String, Boolean>("234");
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -21,11 +21,10 @@ public class ConstructorExample<A, B> {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val generated: ConstructorExample<Long, Boolean> = ConstructorExample.of(12, 42L, true)
|
||||
assertEquals(generated.name, 42L)
|
||||
val generatedReq: ConstructorExample<String, Boolean> = ConstructorExample.of("234")
|
||||
assertEquals(generatedReq.name, "234")
|
||||
}
|
||||
fun box(): String {
|
||||
val generated: ConstructorExample<Long, Boolean> = ConstructorExample.of(12, 42L, true)
|
||||
assertEquals(generated.name, 42L)
|
||||
val generatedReq: ConstructorExample<String, Boolean> = ConstructorExample.of("234")
|
||||
assertEquals(generatedReq.name, "234")
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+19
-19
@@ -25,30 +25,30 @@ public class GetterTest {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = GetterTest()
|
||||
val getter = obj.getAge()
|
||||
val property = obj.age
|
||||
fun box(): String {
|
||||
val obj = GetterTest()
|
||||
val getter = obj.getAge()
|
||||
val property = obj.age
|
||||
|
||||
//todo kotlin doesn't see isBoolean methods as property
|
||||
// obj.primitiveBoolean
|
||||
obj.isPrimitiveBoolean()
|
||||
//todo kotlin doesn't seee isBoolean methods as property
|
||||
// obj.primitiveBoolean
|
||||
obj.isPrimitiveBoolean()
|
||||
|
||||
obj.boxedBoolean
|
||||
obj.getBoxedBoolean()
|
||||
obj.boxedBoolean
|
||||
obj.getBoxedBoolean()
|
||||
|
||||
//shouldn't be accesible from here
|
||||
// obj.getName()
|
||||
//shouldn't be accesible from here
|
||||
// obj.getName()
|
||||
|
||||
// obj.getInvisible()
|
||||
// obj.getInvisible()
|
||||
|
||||
OverridenGetterTest().usage()
|
||||
}
|
||||
OverridenGetterTest().usage()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
class OverridenGetterTest : GetterTest() {
|
||||
fun usage() {
|
||||
getName()
|
||||
}
|
||||
class OverridenGetterTest : GetterTest() {
|
||||
fun usage() {
|
||||
getName()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-15
@@ -23,26 +23,25 @@ public class ClassLevelGetterTest {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = ClassLevelGetterTest()
|
||||
val getter = obj.getAge()
|
||||
val property = obj.age
|
||||
fun box(): String {
|
||||
val obj = ClassLevelGetterTest()
|
||||
val getter = obj.getAge()
|
||||
val property = obj.age
|
||||
|
||||
obj.isPrimitiveBoolean()
|
||||
obj.isPrimitiveBoolean()
|
||||
|
||||
obj.boxedBoolean
|
||||
obj.getBoxedBoolean()
|
||||
obj.boxedBoolean
|
||||
obj.getBoxedBoolean()
|
||||
|
||||
//shouldn't be accesible from here
|
||||
//shouldn't be accesible from here
|
||||
// obj.getName()
|
||||
|
||||
OverridenGetterTest().usage()
|
||||
}
|
||||
OverridenGetterTest().usage()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
class OverridenGetterTest : ClassLevelGetterTest() {
|
||||
fun usage() {
|
||||
getName()
|
||||
}
|
||||
class OverridenGetterTest : ClassLevelGetterTest() {
|
||||
fun usage() {
|
||||
getName()
|
||||
}
|
||||
}
|
||||
|
||||
+13
-14
@@ -27,24 +27,23 @@ public class FluentTest {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = FluentTest()
|
||||
assertEquals(obj.age(), 10)
|
||||
fun box(): String {
|
||||
val obj = FluentTest()
|
||||
assertEquals(obj.age(), 10)
|
||||
|
||||
obj.primitiveBoolean()
|
||||
obj.primitiveBoolean()
|
||||
|
||||
obj.boxedBoolean()
|
||||
obj.boxedBoolean()
|
||||
|
||||
obj.overrideAnnotation
|
||||
obj.getOverrideAnnotation()
|
||||
obj.overrideAnnotation
|
||||
obj.getOverrideAnnotation()
|
||||
|
||||
OverridenGetterTest().usage()
|
||||
}
|
||||
OverridenGetterTest().usage()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
class OverridenGetterTest : FluentTest() {
|
||||
fun usage() {
|
||||
name()
|
||||
}
|
||||
class OverridenGetterTest : FluentTest() {
|
||||
fun usage() {
|
||||
name()
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -22,9 +22,9 @@ public class ConstructorExample {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val existing = ConstructorExample("existing")
|
||||
val generated = ConstructorExample()
|
||||
}
|
||||
fun box(): String {
|
||||
val existing = ConstructorExample("existing")
|
||||
val generated = ConstructorExample()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ public class ConstructorExample {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val existing: ConstructorExample = ConstructorExample("existing")
|
||||
val generated: ConstructorExample = ConstructorExample.make()
|
||||
}
|
||||
fun box(): String {
|
||||
val existing: ConstructorExample = ConstructorExample("existing")
|
||||
val generated: ConstructorExample = ConstructorExample.make()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
+5
-6
@@ -14,10 +14,9 @@ public class GetterSetterExample {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = GetterSetterExample()
|
||||
val age: Int = obj.getAge()
|
||||
val name: String? = obj.getName()
|
||||
}
|
||||
fun box(): String {
|
||||
val obj = GetterSetterExample()
|
||||
val age: Int = obj.getAge()
|
||||
val name: String? = obj.getName()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -23,8 +23,7 @@ public class Foo {
|
||||
//FILE: test.kt
|
||||
|
||||
@Anno
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = Foo()
|
||||
}
|
||||
fun box(): String {
|
||||
val obj = Foo()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+4
-5
@@ -13,8 +13,7 @@ public class ChildClass extends ParentClass {}
|
||||
|
||||
|
||||
//FILE: test.kt
|
||||
class Test {
|
||||
fun run() {
|
||||
ChildClass::class
|
||||
}
|
||||
}
|
||||
fun box(): String {
|
||||
ChildClass::class
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ public class ConstructorExample {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val generated = ConstructorExample("foo", true)
|
||||
assertEquals(generated.foo, "foo")
|
||||
}
|
||||
fun box(): String {
|
||||
val generated = ConstructorExample("foo", true)
|
||||
assertEquals(generated.foo, "foo")
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,8 @@ public class ConstructorExample {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val generated = ConstructorExample.build("foo", true, 12)
|
||||
assertEquals(generated.foo, "foo")
|
||||
}
|
||||
fun box(): String {
|
||||
val generated = ConstructorExample.build("foo", true, 12)
|
||||
assertEquals(generated.foo, "foo")
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+13
-14
@@ -20,25 +20,24 @@ public class SetterTest {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = SetterTest()
|
||||
obj.setAge(42)
|
||||
obj.age = 42
|
||||
fun box(): String {
|
||||
val obj = SetterTest()
|
||||
obj.setAge(42)
|
||||
obj.age = 42
|
||||
|
||||
//synthetic property generated only when there is a getter
|
||||
//synthetic property generated only when there is a getter
|
||||
// obj.primitiveBoolean = false
|
||||
obj.setPrimitiveBoolean(true)
|
||||
obj.setPrimitiveBoolean(true)
|
||||
|
||||
//shouldn't be accesible from here
|
||||
//shouldn't be accesible from here
|
||||
// obj.setName("abc")
|
||||
|
||||
OverridenGetterTest().usage()
|
||||
}
|
||||
OverridenGetterTest().usage()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
class OverridenGetterTest : SetterTest() {
|
||||
fun usage() {
|
||||
setName("abc")
|
||||
}
|
||||
class OverridenGetterTest : SetterTest() {
|
||||
fun usage() {
|
||||
setName("abc")
|
||||
}
|
||||
}
|
||||
|
||||
+11
-12
@@ -23,18 +23,17 @@ public class SetterTest {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = SetterTest()
|
||||
obj.setAge(42)
|
||||
assertEquals(obj.age, 42)
|
||||
obj.age = 43
|
||||
assertEquals(obj.age, 43)
|
||||
fun box(): String {
|
||||
val obj = SetterTest()
|
||||
obj.setAge(42)
|
||||
assertEquals(obj.age, 42)
|
||||
obj.age = 43
|
||||
assertEquals(obj.age, 43)
|
||||
|
||||
obj.setPrimitiveBoolean(true)
|
||||
obj.setPrimitiveBoolean(true)
|
||||
|
||||
|
||||
// no setters generated for final variable
|
||||
// obj.setFinalName("error")
|
||||
}
|
||||
// no setters generated for final variable
|
||||
// obj.setFinalName("error")
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
+9
-11
@@ -25,15 +25,13 @@ public class SetterTest {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = SetterTest()
|
||||
obj.fluent(12)
|
||||
assertEquals(obj.fluent(), 12)
|
||||
obj.setChained("zz").getChained()
|
||||
assertEquals(obj.getChained(), "zz")
|
||||
obj.whyNotBoth("zzz").whyNotBoth()
|
||||
assertEquals(obj.whyNotBoth(), "zzz")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val obj = SetterTest()
|
||||
obj.fluent(12)
|
||||
assertEquals(obj.fluent(), 12)
|
||||
obj.setChained("zz").getChained()
|
||||
assertEquals(obj.getChained(), "zz")
|
||||
obj.whyNotBoth("zzz").whyNotBoth()
|
||||
assertEquals(obj.whyNotBoth(), "zzz")
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+5
-6
@@ -13,10 +13,9 @@ public class GetterSetterExample {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = GetterSetterExample()
|
||||
val getter = obj.getAge()
|
||||
val property = obj.age
|
||||
}
|
||||
fun box(): String {
|
||||
val obj = GetterSetterExample()
|
||||
val getter = obj.getAge()
|
||||
val property = obj.age
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+11
-12
@@ -28,17 +28,16 @@ import lombok.*;
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
fun run() {
|
||||
val obj = ValueExample("name", 12, 4.5)
|
||||
assertEquals(obj.getName(), "name")
|
||||
assertEquals(obj.name, "name")
|
||||
assertEquals(obj.getAge(), 12)
|
||||
assertEquals(obj.age, 12)
|
||||
assertEquals(obj.score, 4.5)
|
||||
fun box(): String {
|
||||
val obj = ValueExample("name", 12, 4.5)
|
||||
assertEquals(obj.getName(), "name")
|
||||
assertEquals(obj.name, "name")
|
||||
assertEquals(obj.getAge(), 12)
|
||||
assertEquals(obj.age, 12)
|
||||
assertEquals(obj.score, 4.5)
|
||||
|
||||
val ex: ValueExample.Exercise<Int> = ValueExample.Exercise.of("nam1e", 42)
|
||||
assertEquals(ex.name, "nam1e")
|
||||
assertEquals(ex.value, 42)
|
||||
}
|
||||
val ex: ValueExample.Exercise<Int> = ValueExample.Exercise.of("nam1e", 42)
|
||||
assertEquals(ex.name, "nam1e")
|
||||
assertEquals(ex.value, 42)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+5
-7
@@ -18,11 +18,9 @@ public class WithExample {
|
||||
|
||||
//FILE: test.kt
|
||||
|
||||
class Test {
|
||||
|
||||
fun run() {
|
||||
val obj: WithExample = WithExample().withAge(16).withName("fooo")
|
||||
assertEquals(obj.getName(), "fooo")
|
||||
assertEquals(obj.age, 16)
|
||||
}
|
||||
fun box(): String {
|
||||
val obj: WithExample = WithExample().withAge(16).withName("fooo")
|
||||
assertEquals(obj.getName(), "fooo")
|
||||
assertEquals(obj.age, 16)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user