@@ -0,0 +1,1240 @@
+/*%0A * Copyright (c) 2009-2013 Topi Nieminen%0A */%0Apackage fi.tnie.db.model;%0A%0Aimport fi.tnie.db.model.cm.AbstractTransformationModel;%0Aimport junit.framework.TestCase;%0A%0Apublic class TransformationModelTest extends TestCase %7B%0A%0A%09public void testComputedModel() %7B%09%09%0A%09%09final MutableStringModel source = new MutableStringModel(null); %0A%09%09 %0A%09%09final AbstractTransformationModel%3CInteger, String%3E cm =%0A%09%09%09new AbstractTransformationModel%3CInteger, String%3E(source) %7B%0A%0A%09%09%09%09@Override%0A%09%09%09%09public Integer transform(String source) %7B%09%09%09%09%09%09%09%09%09%0A%09%09%09%09%09return (source == null) ? null : Integer.valueOf(source.length());%0A%09%09%09%09%7D%0A%09%09%7D;%0A%09%09%0A%09%09ChangeCounter%3CInteger%3E cc = new ChangeCounter%3CInteger%3E();%09%09%09%09%0A%09%09cm.addChangeHandler(cc);%0A%09%09%0A%09%09assertNull(cm.get());%0A%09%09%0A%09%09String input;%09%09%0A%09%0A%09%09input = %22%22;%0A%09%09source.set(input);%0A%09%09assertNotNull(cm.get());%09%09%0A%09%09assertEquals(input.length(), cm.get().intValue());%0A%09%09assertEquals(1, cc.getCount());%0A%0A%09%09input = %22abc%22; %0A%09%09source.set(input);%0A%09%09assertNotNull(cm.get());%0A%09%09assertEquals(input.length(), cm.get().intValue());%0A%09%09assertEquals(2, cc.getCount());%0A%0A%09%09input = %22bac%22; %0A%09%09source.set(input);%0A%09%09assertNotNull(cm.get());%0A%09%09assertEquals(input.length(), cm.get().intValue());%0A%09%09// length did not changed%0A%09%09assertEquals(2, cc.getCount());%0A%09%7D%09%0A%7D%0A

Add test case for AbstractTransformationModel