aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/java-native/src/test/java/com/example/myproject/BUILD
blob: 72066b3f0a955d3129abd47cda77b3eb68202f59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
java_test(
    name = "hello",
    srcs = ["TestHello.java"],
    test_class = "com.example.myproject.TestHello",
    deps = [
        "//examples/java-native/src/main/java/com/example/myproject:hello-lib",
        "//third_party:junit4",
    ],
)

java_test(
    name = "custom",
    srcs = ["TestCustomGreeting.java"],
    test_class = "com.example.myproject.TestCustomGreeting",
    deps = [
        "//examples/java-native/src/main/java/com/example/myproject:custom-greeting",
        "//third_party:junit4",
    ],
)

java_test(
    name = "custom_with_test_class",
    srcs = glob(["Test*.java"]),
    test_class = "com.example.myproject.TestCustomGreeting",
    deps = [
        "//examples/java-native/src/main/java/com/example/myproject:custom-greeting",
        "//third_party:junit4",
    ],
)

java_test(
    name = "fail",
    srcs = ["Fail.java"],
    test_class = "com.example.myproject.Fail",
    deps = ["//third_party:junit4"],
)

# This exercises the "cpu:<num>" tag.
#
# Expected behavior:
# test0 and test1 run together then one of the other two alone, and then the remaining one alone.
java_test(
    name = "sleep0",
    srcs = ["TestSleep.java"],
    test_class = "com.example.myproject.TestSleep",
    deps = ["//third_party:junit4"],
)

java_test(
    name = "sleep1",
    srcs = ["TestSleep.java"],
    test_class = "com.example.myproject.TestSleep",
    deps = ["//third_party:junit4"],
)

java_test(
    name = "sleep2",
    srcs = ["TestSleep.java"],
    tags = ["cpu:20000"],
    test_class = "com.example.myproject.TestSleep",
    deps = ["//third_party:junit4"],
)

java_test(
    name = "sleep3",
    srcs = ["TestSleep.java"],
    tags = ["cpu:20000"],
    test_class = "com.example.myproject.TestSleep",
    deps = ["//third_party:junit4"],
)

# This attempts to run TestCustomGreeting.java without any resources, so fails.
java_test(
    name = "resource-fail",
    srcs = glob(["Test*.java"]),
    test_class = "com.example.myproject.TestCustomGreeting",
    deps = [
        "//examples/java-native/src/main/java/com/example/myproject:hello-lib",
        "//third_party:junit4",
    ],
)

filegroup(
    name = "srcs",
    srcs = glob(["**/*.java"]) + ["BUILD"],
    visibility = ["//examples/java-native:__pkg__"],
)