Put testsuite in its own directory
This commit is contained in:
parent
0cf25ebaf4
commit
08fde62368
16 changed files with 157 additions and 0 deletions
10
testsuite/classes/java/CustomAttribute.java
Normal file
10
testsuite/classes/java/CustomAttribute.java
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface CustomAttribute {
|
||||
}
|
||||
|
||||
6
testsuite/classes/java/Hello.java
Normal file
6
testsuite/classes/java/Hello.java
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class Hello {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello, world!");
|
||||
}
|
||||
}
|
||||
|
||||
10
testsuite/classes/java/Interface.java
Normal file
10
testsuite/classes/java/Interface.java
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
public interface Interface {
|
||||
|
||||
String getName();
|
||||
|
||||
default void sayHello() {
|
||||
System.out.println("Hello " + getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
41
testsuite/classes/java/Main.java
Normal file
41
testsuite/classes/java/Main.java
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import java.util.function.Supplier;
|
||||
|
||||
@CustomAttribute
|
||||
public class Main implements Runnable, Supplier<Integer>, Interface {
|
||||
private static final String name = "John";
|
||||
private static final int number = 42;
|
||||
private static final double funnyNumber = 6.9;
|
||||
|
||||
public static void main() {
|
||||
new Main().sayHello();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Main.main();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer get() {
|
||||
return number;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void throwSomething() throws Throwable {
|
||||
throw new Throwable() {
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "Hello";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static class Inner {
|
||||
private static final String name = "Inner John";
|
||||
}
|
||||
}
|
||||
|
||||
22
testsuite/classes/java/MultiThreading.java
Normal file
22
testsuite/classes/java/MultiThreading.java
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import java.util.concurrent.Executors;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class MultiThreading {
|
||||
private int number = 0;
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
final var multiThreading = new MultiThreading();
|
||||
|
||||
final var service = Executors.newFixedThreadPool(3);
|
||||
IntStream.range(0, 1000)
|
||||
.forEach(count -> service.submit(multiThreading::increment));
|
||||
service.awaitTermination(1000, TimeUnit.MILLISECONDS);
|
||||
|
||||
System.out.println(multiThreading.number);
|
||||
}
|
||||
|
||||
public synchronized void increment() {
|
||||
number += 1;
|
||||
}
|
||||
}
|
||||
BIN
testsuite/classes/java/Object.class
Normal file
BIN
testsuite/classes/java/Object.class
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue