diff -r af027874f93e -r f9e80d48e9b4 javaquery/api/src/test/java/org/apidesign/bck2brwsr/htmlpage/ModelTest.java --- a/javaquery/api/src/test/java/org/apidesign/bck2brwsr/htmlpage/ModelTest.java Mon Jan 21 10:06:42 2013 +0100 +++ b/javaquery/api/src/test/java/org/apidesign/bck2brwsr/htmlpage/ModelTest.java Mon Jan 21 11:55:27 2013 +0100 @@ -65,11 +65,40 @@ assertTrue(my.mutated.contains("unrelated"), "Its name is unrelated"); } + @Test public void computedPropertyCannotWriteToModel() { + try { + String res = Model.getNotAllowedWrite(); + fail("We should not be allowed to write to the model: " + res); + } catch (IllegalStateException ex) { + // OK, we can't read + } + } + + @Test public void computedPropertyCannotReadToModel() { + try { + String res = Model.getNotAllowedRead(); + fail("We should not be allowed to read from the model: " + res); + } catch (IllegalStateException ex) { + // OK, we can't read + } + } + @ComputedProperty static int powerValue(int value) { return value * value; } + @ComputedProperty + static String notAllowedRead() { + return "Not allowed callback: " + Model.getUnrelated(); + } + + @ComputedProperty + static String notAllowedWrite() { + Model.setUnrelated(11); + return "Not allowed callback!"; + } + static class MockKnockout extends Knockout { List mutated = new ArrayList();