Skip to content

Commit 4f80b20

Browse files
authored
Merge pull request #1 from XRater/HW1-Lazy
Hw1 lazy
2 parents ed9a6cd + fa06437 commit 4f80b20

10 files changed

Lines changed: 556 additions & 0 deletions

File tree

HW1-Lazy/build.gradle

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
}
5+
dependencies {
6+
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.2'
7+
classpath 'com.google.guava:guava:23.5-jre'
8+
classpath 'org.mockito:mockito-all:2.0.2-beta'
9+
}
10+
}
11+
12+
repositories {
13+
mavenCentral()
14+
}
15+
16+
ext.junit4Version = '4.12'
17+
ext.junitVintageVersion = '4.12.2'
18+
ext.junitPlatformVersion = '1.0.2'
19+
ext.junitJupiterVersion = '5.0.2'
20+
ext.log4jVersion = '2.9.0'
21+
22+
apply plugin: 'java'
23+
apply plugin: 'eclipse'
24+
apply plugin: 'idea'
25+
apply plugin: 'org.junit.platform.gradle.plugin'
26+
27+
jar {
28+
baseName = 'junit5-gradle-consumer'
29+
}
30+
31+
compileTestJava {
32+
sourceCompatibility = 1.9
33+
targetCompatibility = 1.9
34+
options.compilerArgs += '-parameters'
35+
}
36+
37+
dependencies {
38+
// JUnit Jupiter API and TestEngine implementation
39+
testCompile("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
40+
testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")
41+
42+
// If you also want to support JUnit 3 and JUnit 4 tests
43+
testCompile("junit:junit:${junit4Version}")
44+
testRuntime("org.junit.vintage:junit-vintage-engine:${junitVintageVersion}")
45+
46+
// To avoid compiler warnings about @API annotations in JUnit code
47+
testCompileOnly('org.apiguardian:apiguardian-api:1.0.0')
48+
49+
// To use Log4J's LogManager
50+
testRuntime("org.apache.logging.log4j:log4j-core:${log4jVersion}")
51+
testRuntime("org.apache.logging.log4j:log4j-jul:${log4jVersion}")
52+
53+
// Only needed to run tests in an (IntelliJ) IDE(A) that bundles an older version
54+
testRuntime("org.junit.platform:junit-platform-launcher:${junitPlatformVersion}")
55+
56+
testCompile group: 'org.hamcrest', name: 'hamcrest-junit', version: '2.0.0.0'
57+
compile group: 'org.jetbrains', name: 'annotations', version: '15.0'
58+
59+
compile group: 'com.google.guava', name: 'guava', version: '23.5-jre'
60+
testCompile group: 'org.mockito', name: 'mockito-all', version: '2.0.2-beta'
61+
}
62+
63+
task wrapper(type: Wrapper) {
64+
description = 'Generates gradlew[.bat] scripts'
65+
gradleVersion = '4.3.1'
66+
}
53.1 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Tue Feb 27 02:20:16 MSK 2018
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-all.zip

HW1-Lazy/gradlew

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HW1-Lazy/gradlew.bat

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HW1-Lazy/settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rootProject.name = 'HW1-Lazy'
2+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package ru.spbau.mit.kirakosian;
2+
3+
/**
4+
* Interface to store exactly one value and provide lazy evaluations. It means, that target
5+
* value will be evaluated only one time, on the first get method call.
6+
*
7+
* This class in some way similar to Singleton pattern.
8+
*
9+
* @param <T> type of the stored element.
10+
*/
11+
public interface Lazy<T> {
12+
13+
/**
14+
* Returns stored in Lazy value. Evaluates this value if it is not known yet,
15+
* otherwise returns already evaluated value.
16+
*/
17+
T get();
18+
19+
}

0 commit comments

Comments
 (0)