forked from loafle/openapi-generator-original
Change templates and test code so that the sample is 1.7 compatible
Alas.
This commit is contained in:
parent
8bb774f821
commit
d60f7d1186
@ -71,8 +71,8 @@ if(hasProperty('target') && target == 'android') {
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||
targetCompatibility = JavaVersion.VERSION_1_7
|
||||
|
||||
install {
|
||||
repositories.mavenInstaller {
|
||||
|
@ -100,8 +100,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
@ -15,26 +15,77 @@ repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
}
|
||||
if(hasProperty('target') && target == 'android') {
|
||||
|
||||
install {
|
||||
repositories.mavenInstaller {
|
||||
pom.artifactId = 'swagger-petstore-retrofit2'
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
android {
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion '22.0.0'
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 22
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_7
|
||||
targetCompatibility JavaVersion.VERSION_1_7
|
||||
}
|
||||
|
||||
// Rename the aar correctly
|
||||
libraryVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = output.outputFile
|
||||
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
||||
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||
output.outputFile = new File(outputFile.parent, fileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
android.libraryVariants.all { variant ->
|
||||
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
|
||||
task.description = "Create jar artifact for ${variant.name}"
|
||||
task.dependsOn variant.javaCompile
|
||||
task.from variant.javaCompile.destinationDir
|
||||
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
||||
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||
artifacts.add('archives', task);
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||
targetCompatibility = JavaVersion.VERSION_1_7
|
||||
|
||||
install {
|
||||
repositories.mavenInstaller {
|
||||
pom.artifactId = 'swagger-petstore-retrofit2'
|
||||
}
|
||||
}
|
||||
|
||||
task execute(type:JavaExec) {
|
||||
main = System.getProperty('mainClass')
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
}
|
||||
|
||||
task execute(type:JavaExec) {
|
||||
main = System.getProperty('mainClass')
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
|
||||
|
||||
ext {
|
||||
okhttp_version = "2.5.0"
|
||||
oltu_version = "1.0.0"
|
||||
@ -43,6 +94,7 @@ ext {
|
||||
swagger_annotations_version = "1.5.0"
|
||||
junit_version = "4.12"
|
||||
rx_java_version = "1.0.15"
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -100,8 +100,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
@ -137,16 +137,18 @@
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>${okhttp-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.reactivex</groupId>
|
||||
<artifactId>rxjava</artifactId>
|
||||
<version>${rxjava-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.retrofit</groupId>
|
||||
<artifactId>adapter-rxjava</artifactId>
|
||||
<version>${retrofit-version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.reactivex</groupId>
|
||||
<artifactId>rxjava</artifactId>
|
||||
<version>${rxjava-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.retrofit</groupId>
|
||||
<artifactId>adapter-rxjava</artifactId>
|
||||
<version>${retrofit-version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.swagger.client;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-21T16:52:39.577+01:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-22T16:44:03.093+01:00")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
|
@ -7,21 +7,14 @@ import io.swagger.client.model.*;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
import rx.Notification;
|
||||
import rx.Observable;
|
||||
|
||||
import com.squareup.okhttp.MediaType;
|
||||
import com.squareup.okhttp.RequestBody;
|
||||
import rx.Subscriber;
|
||||
import rx.functions.Action1;
|
||||
import rx.observers.TestSubscriber;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@ -36,14 +29,22 @@ public class PetApiTest {
|
||||
@Test
|
||||
public void testCreateAndGetPet() throws Exception {
|
||||
final Pet pet = createRandomPet();
|
||||
api.addPet(pet).subscribe(aVoid -> {
|
||||
api.getPetById(pet.getId()).subscribe(fetched -> {
|
||||
assertNotNull(fetched);
|
||||
assertEquals(pet.getId(), fetched.getId());
|
||||
assertNotNull(fetched.getCategory());
|
||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
||||
});
|
||||
api.addPet(pet).subscribe(new SkeletonSubscriber<Void>() {
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber<Pet>() {
|
||||
@Override
|
||||
public void onNext(Pet fetched) {
|
||||
assertNotNull(fetched);
|
||||
assertEquals(pet.getId(), fetched.getId());
|
||||
assertNotNull(fetched.getCategory());
|
||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -51,14 +52,22 @@ public class PetApiTest {
|
||||
final Pet pet = createRandomPet();
|
||||
pet.setName("programmer");
|
||||
|
||||
api.updatePet(pet).subscribe(aVoid -> {
|
||||
api.getPetById(pet.getId()).subscribe(fetched -> {
|
||||
assertNotNull(fetched);
|
||||
assertEquals(pet.getId(), fetched.getId());
|
||||
assertNotNull(fetched.getCategory());
|
||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
||||
});
|
||||
api.updatePet(pet).subscribe(new SkeletonSubscriber<Void>() {
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber<Pet>() {
|
||||
@Override
|
||||
public void onNext(Pet fetched) {
|
||||
assertNotNull(fetched);
|
||||
assertEquals(pet.getId(), fetched.getId());
|
||||
assertNotNull(fetched.getCategory());
|
||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -67,21 +76,29 @@ public class PetApiTest {
|
||||
pet.setName("programmer");
|
||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
||||
|
||||
api.updatePet(pet).subscribe(aVoid -> {
|
||||
api.findPetsByStatus(Arrays.asList(new String[]{"available"})).subscribe(pets -> {
|
||||
assertNotNull(pets);
|
||||
api.updatePet(pet).subscribe(new SkeletonSubscriber<Void>() {
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
api.findPetsByStatus(Arrays.asList(new String[]{"available"})).subscribe(new SkeletonSubscriber<List<Pet>>() {
|
||||
@Override
|
||||
public void onNext(List<Pet> pets) {
|
||||
assertNotNull(pets);
|
||||
|
||||
boolean found = false;
|
||||
for (Pet fetched : pets) {
|
||||
if (fetched.getId().equals(pet.getId())) {
|
||||
found = true;
|
||||
break;
|
||||
boolean found = false;
|
||||
for (Pet fetched : pets) {
|
||||
if (fetched.getId().equals(pet.getId())) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assertTrue(found);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
assertTrue(found);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -96,55 +113,79 @@ public class PetApiTest {
|
||||
tags.add(tag1);
|
||||
pet.setTags(tags);
|
||||
|
||||
api.updatePet(pet).subscribe(aVoid -> {
|
||||
api.findPetsByTags(Arrays.asList(new String[]{"friendly"})).subscribe(pets -> {
|
||||
assertNotNull(pets);
|
||||
api.updatePet(pet).subscribe(new SkeletonSubscriber<Void>() {
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
api.findPetsByTags(Arrays.asList(new String[]{"friendly"})).subscribe(new SkeletonSubscriber<List<Pet>>() {
|
||||
@Override
|
||||
public void onNext(List<Pet> pets) {
|
||||
assertNotNull(pets);
|
||||
|
||||
boolean found = false;
|
||||
for (Pet fetched : pets) {
|
||||
if (fetched.getId().equals(pet.getId())) {
|
||||
found = true;
|
||||
break;
|
||||
boolean found = false;
|
||||
for (Pet fetched : pets) {
|
||||
if (fetched.getId().equals(pet.getId())) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdatePetWithForm() throws Exception {
|
||||
final Pet pet = createRandomPet();
|
||||
pet.setName("frank");
|
||||
api.addPet(pet).subscribe(aVoid1 -> {
|
||||
api.getPetById(pet.getId()).subscribe(fetched -> {
|
||||
api.addPet(pet).subscribe(SkeletonSubscriber.failTestOnError());
|
||||
api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber<Pet>() {
|
||||
@Override
|
||||
public void onNext(final Pet fetched) {
|
||||
api.updatePetWithForm(String.valueOf(fetched.getId()), "furt", null)
|
||||
.subscribe(aVoid -> {
|
||||
api.getPetById(fetched.getId()).subscribe(updated -> {
|
||||
assertEquals(updated.getName(), "furt");
|
||||
});
|
||||
.subscribe(new SkeletonSubscriber<Void>() {
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
api.getPetById(fetched.getId()).subscribe(new SkeletonSubscriber<Pet>() {
|
||||
@Override
|
||||
public void onNext(Pet updated) {
|
||||
assertEquals(updated.getName(), "furt");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeletePet() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
api.addPet(pet).subscribe(aVoid -> {
|
||||
});
|
||||
api.addPet(pet).subscribe(SkeletonSubscriber.failTestOnError());
|
||||
|
||||
api.getPetById(pet.getId()).subscribe(fetched -> {
|
||||
api.deletePet(fetched.getId(), null).subscribe(aVoid -> {
|
||||
api.getPetById(fetched.getId()).subscribe(
|
||||
deletedPet -> {
|
||||
fail("Should not have found deleted pet.");
|
||||
},
|
||||
exception -> {
|
||||
// expected, because the pet has been deleted.
|
||||
});
|
||||
api.getPetById(pet.getId()).subscribe(new SkeletonSubscriber<Pet>() {
|
||||
@Override
|
||||
public void onNext(Pet fetched) {
|
||||
|
||||
});
|
||||
api.deletePet(fetched.getId(), null).subscribe(SkeletonSubscriber.failTestOnError());
|
||||
api.getPetById(fetched.getId()).subscribe(new SkeletonSubscriber<Pet>() {
|
||||
@Override
|
||||
public void onNext(Pet deletedPet) {
|
||||
fail("Should not have found deleted pet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
// expected, because the pet has been deleted.
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -157,15 +198,14 @@ public class PetApiTest {
|
||||
writer.close();
|
||||
|
||||
Pet pet = createRandomPet();
|
||||
api.addPet(pet).subscribe(aVoid -> {
|
||||
RequestBody body = RequestBody.create(MediaType.parse("text/plain"), file);
|
||||
api.uploadFile(pet.getId(), "a test file", body).subscribe(
|
||||
aVoid1 -> {
|
||||
// intentionally left blank.
|
||||
},
|
||||
error -> {
|
||||
// this also yields a 400 for other tests, so I guess it's okay...
|
||||
});
|
||||
api.addPet(pet).subscribe(SkeletonSubscriber.failTestOnError());
|
||||
|
||||
RequestBody body = RequestBody.create(MediaType.parse("text/plain"), file);
|
||||
api.uploadFile(pet.getId(), "a test file", body).subscribe(new SkeletonSubscriber<Void>() {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
// this also yields a 400 for other tests, so I guess it's okay...
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,30 @@
|
||||
package io.swagger.petstore.test;
|
||||
|
||||
import junit.framework.TestFailure;
|
||||
import rx.Subscriber;
|
||||
|
||||
/**
|
||||
* Skeleton subscriber for tests that will fail when onError() is called unexpectedly.
|
||||
*/
|
||||
public abstract class SkeletonSubscriber<T> extends Subscriber<T>{
|
||||
|
||||
public static <T> SkeletonSubscriber<T> failTestOnError() {
|
||||
return new SkeletonSubscriber<T>() {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
// space for rent
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(T t) {
|
||||
// space for rent
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
throw new RuntimeException("Subscriber onError() called with unhandled exception!", e);
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ import java.util.Map;
|
||||
import org.junit.*;
|
||||
|
||||
import retrofit.Response;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class StoreApiTest {
|
||||
@ -21,40 +22,56 @@ public class StoreApiTest {
|
||||
|
||||
@Test
|
||||
public void testGetInventory() throws Exception {
|
||||
api.getInventory().subscribe(inventory -> {
|
||||
assertTrue(inventory.keySet().size() > 0);
|
||||
api.getInventory().subscribe(new SkeletonSubscriber<Map<String, Integer>>() {
|
||||
@Override
|
||||
public void onNext(Map<String, Integer> inventory) {
|
||||
assertTrue(inventory.keySet().size() > 0);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPlaceOrder() throws Exception {
|
||||
Order order = createOrder();
|
||||
api.placeOrder(order).subscribe(placed -> {});
|
||||
api.getOrderById(String.valueOf(order.getId())).subscribe(fetched -> {
|
||||
assertEquals(order.getId(), fetched.getId());
|
||||
assertEquals(order.getPetId(), fetched.getPetId());
|
||||
assertEquals(order.getQuantity(), fetched.getQuantity());
|
||||
final Order order = createOrder();
|
||||
api.placeOrder(order).subscribe(SkeletonSubscriber.failTestOnError());
|
||||
api.getOrderById(String.valueOf(order.getId())).subscribe(new SkeletonSubscriber<Order>() {
|
||||
@Override
|
||||
public void onNext(Order fetched) {
|
||||
assertEquals(order.getId(), fetched.getId());
|
||||
assertEquals(order.getPetId(), fetched.getPetId());
|
||||
assertEquals(order.getQuantity(), fetched.getQuantity());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteOrder() throws Exception {
|
||||
Order order = createOrder();
|
||||
api.placeOrder(order).subscribe(order1 -> {
|
||||
final Order order = createOrder();
|
||||
api.placeOrder(order).subscribe(SkeletonSubscriber.failTestOnError());
|
||||
|
||||
api.getOrderById(String.valueOf(order.getId())).subscribe(new SkeletonSubscriber<Order>() {
|
||||
@Override
|
||||
public void onNext(Order fetched) {
|
||||
assertEquals(fetched.getId(), order.getId());
|
||||
}
|
||||
});
|
||||
|
||||
api.getOrderById(String.valueOf(order.getId())).subscribe(fetched -> {
|
||||
assertEquals(fetched.getId(), order.getId());
|
||||
});
|
||||
|
||||
api.deleteOrder(String.valueOf(order.getId())).subscribe(aVoid -> {
|
||||
});
|
||||
api.getOrderById(String.valueOf(order.getId())).subscribe(
|
||||
order1 -> {
|
||||
throw new RuntimeException("Should not have found deleted order.");
|
||||
},
|
||||
error -> {}
|
||||
);
|
||||
api.deleteOrder(String.valueOf(order.getId())).subscribe(SkeletonSubscriber.failTestOnError());
|
||||
api.getOrderById(String.valueOf(order.getId()))
|
||||
.subscribe(new SkeletonSubscriber<Order>() {
|
||||
@Override
|
||||
public void onNext(Order order) {
|
||||
throw new RuntimeException("Should not have found deleted order.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
// should not find deleted order.
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private Order createOrder() {
|
||||
|
@ -8,8 +8,13 @@ import io.swagger.client.model.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* NOTE: This serves as a sample and test case for the generator, which is why this is java-7 code.
|
||||
* Much looks much nicer with no anonymous classes.
|
||||
*/
|
||||
public class UserApiTest {
|
||||
UserApi api = null;
|
||||
|
||||
@ -20,40 +25,52 @@ public class UserApiTest {
|
||||
|
||||
@Test
|
||||
public void testCreateUser() throws Exception {
|
||||
User user = createUser();
|
||||
final User user = createUser();
|
||||
|
||||
api.createUser(user).subscribe(aVoid -> {
|
||||
api.getUserByName(user.getUsername()).subscribe(fetched -> {
|
||||
assertEquals(user.getId(), fetched.getId());
|
||||
});
|
||||
api.createUser(user).subscribe(new SkeletonSubscriber<Void>() {
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
api.getUserByName(user.getUsername()).subscribe(new SkeletonSubscriber<User>() {
|
||||
@Override
|
||||
public void onNext(User fetched) {
|
||||
assertEquals(user.getId(), fetched.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateUsersWithArray() throws Exception {
|
||||
User user1 = createUser();
|
||||
final User user1 = createUser();
|
||||
user1.setUsername("abc123");
|
||||
User user2 = createUser();
|
||||
user2.setUsername("123abc");
|
||||
|
||||
api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})).subscribe(aVoid -> {});
|
||||
api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2})).subscribe(SkeletonSubscriber.failTestOnError());
|
||||
|
||||
api.getUserByName(user1.getUsername()).subscribe(fetched -> {
|
||||
assertEquals(user1.getId(), fetched.getId());
|
||||
api.getUserByName(user1.getUsername()).subscribe(new SkeletonSubscriber<User>() {
|
||||
@Override
|
||||
public void onNext(User fetched) {
|
||||
assertEquals(user1.getId(), fetched.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateUsersWithList() throws Exception {
|
||||
User user1 = createUser();
|
||||
final User user1 = createUser();
|
||||
user1.setUsername("abc123");
|
||||
User user2 = createUser();
|
||||
user2.setUsername("123abc");
|
||||
|
||||
api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})).subscribe(aVoid -> {});
|
||||
api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2})).subscribe(SkeletonSubscriber.failTestOnError());
|
||||
|
||||
api.getUserByName(user1.getUsername()).subscribe(fetched -> {
|
||||
assertEquals(user1.getId(), fetched.getId());
|
||||
api.getUserByName(user1.getUsername()).subscribe(new SkeletonSubscriber<User>() {
|
||||
@Override
|
||||
public void onNext(User fetched) {
|
||||
assertEquals(user1.getId(), fetched.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -62,8 +79,11 @@ public class UserApiTest {
|
||||
User user = createUser();
|
||||
api.createUser(user);
|
||||
|
||||
api.loginUser(user.getUsername(), user.getPassword()).subscribe(token -> {
|
||||
assertTrue(token.startsWith("logged in user session:"));
|
||||
api.loginUser(user.getUsername(), user.getPassword()).subscribe(new SkeletonSubscriber<String>() {
|
||||
@Override
|
||||
public void onNext(String token) {
|
||||
assertTrue(token.startsWith("logged in user session:"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user