Search in sources :

Example 6 with Famille

use of io.vertigo.dynamo.store.data.domain.famille.Famille in project vertigo by KleeGroup.

the class AbstractStoreManagerTest method testCreateFamilleFail.

/**
 * on vérifier l'exception levée si une contrainte bdd n'est pas respecté.
 */
@Test(expected = Exception.class)
public void testCreateFamilleFail() {
    try (VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        final DecimalFormat df = new DecimalFormat("000000000:");
        // -----
        final Famille famille = new Famille();
        final StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 4000; i++) {
            sb.append(df.format(i));
        }
        // libelle
        famille.setLibelle(sb.toString());
        // On doit échouer car le libellé est trop long
        storeManager.getDataStore().create(famille);
        Assert.fail();
    }
}
Also used : Famille(io.vertigo.dynamo.store.data.domain.famille.Famille) DecimalFormat(java.text.DecimalFormat) VTransactionWritable(io.vertigo.commons.transaction.VTransactionWritable) Test(org.junit.Test)

Aggregations

VTransactionWritable (io.vertigo.commons.transaction.VTransactionWritable)6 Famille (io.vertigo.dynamo.store.data.domain.famille.Famille)6 Test (org.junit.Test)6 DtListURI (io.vertigo.dynamo.domain.model.DtListURI)4 DtListURIForCriteria (io.vertigo.dynamo.domain.model.DtListURIForCriteria)3 DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)2 Car (io.vertigo.dynamo.store.data.domain.car.Car)2 URI (io.vertigo.dynamo.domain.model.URI)1 AbstractStoreManagerTest (io.vertigo.dynamo.store.datastore.AbstractStoreManagerTest)1 DecimalFormat (java.text.DecimalFormat)1 ArrayList (java.util.ArrayList)1