Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions HW1-Lazy/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
group 'JavaHW'
version '1.0-SNAPSHOT'

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.2'
classpath 'com.google.guava:guava:23.5-jre'
classpath 'org.mockito:mockito-all:2.0.2-beta'
}
}

repositories {
mavenCentral()
}

ext.junit4Version = '4.12'
ext.junitVintageVersion = '4.12.2'
ext.junitPlatformVersion = '1.0.2'
ext.junitJupiterVersion = '5.0.2'
ext.log4jVersion = '2.9.0'

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.junit.platform.gradle.plugin'

jar {
baseName = 'junit5-gradle-consumer'
version = '1.0.0-SNAPSHOT'
}

compileTestJava {
sourceCompatibility = 1.9
targetCompatibility = 1.9
options.compilerArgs += '-parameters'
}

junitPlatform {
// platformVersion '1.0.2'
filters {
engines {
// include 'junit-jupiter', 'junit-vintage'
// exclude 'custom-engine'
}
tags {
// include 'fast'
exclude 'slow'
}
// includeClassNamePattern '.*Test'
}
// configurationParameter 'junit.jupiter.conditions.deactivate', '*'
// enableStandardTestTask true
// reportsDir file('build/test-results/junit-platform') // this is the default
logManager 'org.apache.logging.log4j.jul.LogManager'
}

dependencies {
// JUnit Jupiter API and TestEngine implementation
testCompile("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")

// If you also want to support JUnit 3 and JUnit 4 tests
testCompile("junit:junit:${junit4Version}")
testRuntime("org.junit.vintage:junit-vintage-engine:${junitVintageVersion}")

// To avoid compiler warnings about @API annotations in JUnit code
testCompileOnly('org.apiguardian:apiguardian-api:1.0.0')

// To use Log4J's LogManager
testRuntime("org.apache.logging.log4j:log4j-core:${log4jVersion}")
testRuntime("org.apache.logging.log4j:log4j-jul:${log4jVersion}")

// Only needed to run tests in an (IntelliJ) IDE(A) that bundles an older version
testRuntime("org.junit.platform:junit-platform-launcher:${junitPlatformVersion}")

testCompile group: 'org.hamcrest', name: 'hamcrest-junit', version: '2.0.0.0'
compile group: 'org.jetbrains', name: 'annotations', version: '15.0'

compile group: 'com.google.guava', name: 'guava', version: '23.5-jre'
testCompile group: 'org.mockito', name: 'mockito-all', version: '2.0.2-beta'
}

task wrapper(type: Wrapper) {
description = 'Generates gradlew[.bat] scripts'
gradleVersion = '4.3.1'
}
Binary file added HW1-Lazy/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions HW1-Lazy/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Tue Feb 27 02:20:16 MSK 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-all.zip
172 changes: 172 additions & 0 deletions HW1-Lazy/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions HW1-Lazy/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions HW1-Lazy/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = 'HW1-Lazy'

19 changes: 19 additions & 0 deletions HW1-Lazy/src/main/java/ru/spbau/mit/kirakosian/Lazy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package ru.spbau.mit.kirakosian;

/**
* Interface to store exactly one value and provide lazy evaluations. It means, that target
* value will be evaluated only one time, on the first get method call.
*
* This class in some way similar to Singleton pattern.
*
* @param <T> type of the stored element.
*/
public interface Lazy<T> {

/**
* Returns stored in Lazy value. Evaluates this value if it is not known yet,
* otherwise returns already evaluated value.
*/
T get();

}
Loading