From: Francois B. <fbe...@ft...> - 2002-12-23 21:30:23
|
Hello Ewald, Please see embedded comments. On Mon, 23 Dec 2002 21:12:07 +0100, "Ewald Arnold" <mo...@ew...> said: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello, > > I have started really transforming the files and came across some > questions: > > > In AbstractExpectationcollention there is > > - - Object[] ==> similar to C array: int[3] = { 1, 2, 3} ? > Probably replace by std::vector. In Java, all objects are subclasses of a root class: Object. This allows an Object[] array to hold any type of objects in the Java universe. > > - - Enumeration ==> no idea Enumeration is just a kind of iterator. > > - - Iterator ==> similar to C++ iterators ? > Except maybe that c++ iterators don't know anything about their end, > so you need two of them. I do not know C++ iterators, so I do not exactly understand your comment. > > > Why are there ExpectationList, ExpectationMap and ExpectationSet? They > seem to > have the same interface and function though their inheritance tree is > different. In the Java Collections Framework, there are three types of collections: List, Set and Map. Map is a dictionnary-like collection. It holds values indexed by key. List is conceptually like an array, accessed through in index. A Set is a collection which holds only one of each value. For example: Set s = new ...; s.add("a"); s.add("b"); s.add("a"); assertEquals("duplicate values not added", 2, s.size()); List l = new ...; l.add("a"); l.add("b"); l.add("a"); assertEquals("duplicate values added", 3, l.size()); > > > In ExpectationValue::verify() I added a check for expectNothing, taken > from > ExpectationValueDouble, seems to be forgotton. The same for the check for > null which seems to test for an unused/unassigned element. > > if( expectNothing ) { > AssertMo.assertNull( myName + " expected no value", > actualValue ); > } else if( expectedValue != null ) { Maybe the MockObjects framework is missing a test in ExpectationDouble... I'll let someone else check on that. > > cheers > Ewald > <snip /> Bye ! Francois Beausoleil -- http://fastmail.fm - I mean, what is it about a decent email service? |
From: Ewald A. <mo...@ew...> - 2002-12-28 10:57:29
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all, > I do not know C++ iterators, so I do not exactly understand your comment. Simply speaking, in C++ iterator are some kind of intelligent pointers and if you work on a sequence your need one to "point" to the beginning and one to "point" to the end. While processing the "cursor" iterator is incremented and the end is reached when cursor==end is true. There is nothing like an end() method. > values indexed by key. List is conceptually like an array, accessed > through in index. A Set is a collection which holds only one of each > value. So if I got this right, a list expectation is to enforce presence *and* order whereas a set just checks presence? I am also not yet sure about ReturnObjectList. I assume it is intended to hold values returned by a single method. This way it only holds values of the same type, e.g. a sequence of characters to simulate a file stream. There are some more files in the dynamic subdirectory. ExpectedCall.java, ExpectedReturn.java or Mock.java for example. Are they of general use? I must admit I don't understand the purpose of them. Maybe it all relies too much on the reflection api to make use of it. BTW: in the meanwhile cvs is rather complete (as far as I can say yet) and compiles cleanly on my side. bye Ewald - -- Ewald Arnold, Germany mailto:ewald at ewald-arnold dot de mobil/sms:+49-162-8001240 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE+DBTkXyQcrD0ZXUYRAtrRAJ9zPMSSf+zy+bcTENwul2fioNdu9ACeKsWR tjVHyTZBRvs75GbM/vd2ZCQ= =OsEt -----END PGP SIGNATURE----- |
From: Jeff M. <je...@mk...> - 2002-12-30 10:14:02
|
> > I am also not yet sure about ReturnObjectList. I assume it is intended to hold > values returned by a single method. This way it only holds values of the same > type, e.g. a sequence of characters to simulate a file stream. > Yup, the ReturnObjectList is a list of objects which is used to setup the values returned by a method call. It's a verifiable object so you can check that all the objects in the list have been pulled out (size()==0) and will through an error if you try and remove objects when the list is empty. -- jeff martin information technologist mkodo limited mobile: 44 (0) 78 5547 8331 phone: 44 (0) 20 2226 4545 email: je...@mk... www.mkodo.com |