Skip to content

Commit

Permalink
Merge pull request #2 from MyDogTom/replace-structure
Browse files Browse the repository at this point in the history
introduced submodules, added kotlin extension functions
  • Loading branch information
MyDogTom authored Oct 26, 2016
2 parents e6dfefa + 0cef5ff commit 6a4c3e8
Show file tree
Hide file tree
Showing 18 changed files with 241 additions and 136 deletions.
68 changes: 10 additions & 58 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,58 +1,10 @@
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties


.gradle/*
.idea/*
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
.idea/*
File renamed without changes.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ repositories {
}
dependencies {
compile 'com.github.MyDogTom:RxTestWrapper:v0.1.0'
testCompile 'com.github.MyDogTom:RxTestWrapper:v0.1.0'
}
```

Expand Down
42 changes: 31 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
group 'com.github.mydogtom'
version '0.1'
// Top-level build file where you can add configuration options common to all sub-projects/modules.

apply plugin: 'java'
buildscript {
repositories {
jcenter()
}
dependencies {

sourceCompatibility = 1.8
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
ext.kotlin_version = '1.0.4'
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
jcenter()
}

repositories {
jcenter()
}

def RXJAVA_VERSION = '1.2.1'

dependencies {
compile "io.reactivex:rxjava:$RXJAVA_VERSION"
subprojects{
apply plugin: 'java'
test {
testLogging.events('failed', 'passed', 'skipped')
}
}

testCompile 'junit:junit:4.12'
testCompile "io.reactivex:rxjava:$RXJAVA_VERSION"
ext {
RXJAVA_VERSION = "1.2.1"
JUNIT_VERSION = "4.12"
}

task clean(type: Delete) {
delete rootProject.buildDir
}
17 changes: 17 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Oct 18 18:07:37 CEST 2016
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
46 changes: 21 additions & 25 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,12 @@
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

Expand All @@ -48,7 +30,6 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
Expand All @@ -59,11 +40,26 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
Expand All @@ -89,7 +85,7 @@ location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
Expand Down
8 changes: 4 additions & 4 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

Expand Down Expand Up @@ -46,7 +46,7 @@ echo location of your Java installation.
goto fail

:init
@rem Get command-line arguments, handling Windows variants
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
Expand Down
1 change: 1 addition & 0 deletions rxtestwrapper-kotlin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
19 changes: 19 additions & 0 deletions rxtestwrapper-kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apply plugin: 'kotlin'

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
sourceCompatibility = "1.8"
targetCompatibility = "1.8"



dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':rxtestwrapper')
compile "io.reactivex:rxjava:$RXJAVA_VERSION"
testCompile "junit:junit:$JUNIT_VERSION"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.github.mydogtom.rxtestwrapper

import rx.Completable
import rx.Observable
import rx.Single
import rx.observables.BlockingObservable

fun <T> Observable<T>.test() : RxTestWrapper<T>{
return RxTestWrapper.assertThat(this)
}

fun Completable.test() : RxTestWrapper<Any>{
return RxTestWrapper.assertThat(this)
}

fun <T> Single<T>.test() : RxTestWrapper<T>{
return RxTestWrapper.assertThat(this)
}

fun <T> BlockingObservable<T>.test() : RxTestWrapper<T>{
return RxTestWrapper.assertThat(this)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.github.mydogtom.rxtestwrapper

import org.junit.Test
import rx.Completable
import rx.Observable
import rx.Single

class ExampleTest{
@Test fun testObservable() {
Observable.just(1).test().hasValue(1).completed()
}

@Test
fun testCompletable() {
Completable.complete().test().completed()
}

@Test
fun testSingle() {
Single.just(1).test().hasValue(1).completed()
}

@Test
fun testBlockingObservable() {
Observable.just(1).toBlocking().test().hasValue(1).completed()
}
}
1 change: 1 addition & 0 deletions rxtestwrapper/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
11 changes: 11 additions & 0 deletions rxtestwrapper/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "io.reactivex:rxjava:$RXJAVA_VERSION"
testCompile "junit:junit:$JUNIT_VERSION"
}




Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static <T> RxTestWrapper<T> assertThat(Single<T> single) {
return new RxTestWrapper<>(single.toObservable());
}

public static <T> RxTestWrapper<T> assertThat(Completable completable) {
public static RxTestWrapper<Object> assertThat(Completable completable) {
return new RxTestWrapper<>(completable.toObservable());
}

Expand Down Expand Up @@ -134,7 +134,7 @@ public final RxTestWrapper<T> valueIsExactlyInstanceOf(Class<? extends T> type)
T value = testSubscriber.getOnNextEvents().get(0);
if (!type.equals(value.getClass())) {
throw new AssertionError(String.format("Expected value to be instance of %s, \nbut was: %s",
type.getName(), value.getClass().getName()));
type.getName(), value.getClass().getName()));
}
return this;
}
Expand Down
Loading

0 comments on commit 6a4c3e8

Please sign in to comment.