Feature/contitional test runner (#1132)

* FIX: warnings (add generics, overrides, fix imports) - should be no effecive code change

* replaced deprecated methods by default methods

* FIX: more compiler warnings

* FIX more warnings - no code changes

* FIX: deprecated call to JsonParseException

* Remove unused code, check unused variables

* ADD: ContitonaltestRunner to skip tests for certain platforms

* Use annotations to control on which platforms a test shoud run

* FIX: compile errors
This commit is contained in:
Roland Praml
2017-09-15 21:03:03 +12:00
committed by Rob Bygrave
parent f3e4696498
commit 8d334ff2e8
17 changed files with 176 additions and 76 deletions
@@ -2,6 +2,8 @@ package org.tests.basic;
import io.ebean.BaseTestCase;
import io.ebean.Ebean;
import io.ebean.Platform;
import io.ebean.annotation.IgnorePlatform;
import org.tests.model.basic.Address;
import org.tests.model.basic.metaannotation.SizeMedium;
import org.junit.Test;
@@ -9,6 +11,7 @@ import org.junit.Test;
import javax.persistence.PersistenceException;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
* Very simple test case to check if Ebean recognizes meta-annotation correctly.
@@ -46,17 +49,16 @@ public class TestMetaAnnotation extends BaseTestCase {
* This test writes 101 spaces to "line1" which is annotated with @Size(max=100).
*/
@Test
@IgnorePlatform({Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL}) // pg & mssql does not fail if string is too long.
public void testWrite101SpacesToLine1() {
if (isH2()) {
Address address = new Address();
address.setLine1(spaces101);
try {
Ebean.save(address);
assertTrue("H2 fails this insert", false);
} catch (PersistenceException e) {
assertTrue(true);
}
Address address = new Address();
address.setLine1(spaces101);
try {
Ebean.save(address);
fail("Test failed, Could insert a too long string");
} catch (PersistenceException e) {
assertTrue(true);
}
}
@@ -64,17 +66,16 @@ public class TestMetaAnnotation extends BaseTestCase {
* This test writes 101 spaces to "line1" which is meta-annotated with {@link SizeMedium}.
*/
@Test
@IgnorePlatform({Platform.POSTGRES, Platform.SQLSERVER, Platform.MYSQL})
public void testWrite101SpacesToLine2() {
if (isH2()) {
Address address = new Address();
address.setLine2(spaces101);
try {
Ebean.save(address);
assertTrue("H2 fails this insert", false);
} catch (PersistenceException e) {
assertTrue(true);
}
Address address = new Address();
address.setLine2(spaces101);
try {
Ebean.save(address);
fail("Test failed, Could insert a too long string");
} catch (PersistenceException e) {
assertTrue(true);
}
}