harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Lee <littlee1...@gmail.com>
Subject Hamcrest
Date Thu, 06 Aug 2009 06:57:15 GMT
Hi guys,

These days I am writing some testcase to the harmony using Hamcrest. I'd
like to introduce harmcrest to the community :-)

Hamcrest provides a library of matcher objects (also known as constraints or
predicates) allowing 'match' rules to be defined declaratively, to be used
in other frameworks. It maybe the only third-party plugin which junit
supports. Check out these beautiful asserts:
1. assertThat(object1, equalTo(object2))
2. assertThat(object1, is(anything()))
3. assertThat(boolean, allOf(boolean1, boolean2))   (like and)
4. assertThat(boolean, anyOf(boolean1, boolean2)) (like or)
5. assertThat(obj1, instanceOf(CLASS))
6. assertThat(obj1, compatibleTo(CLASS))
.............

Hamcrest makes unit tests more readable. Besides it speed my unit coding :-)

More detail, please visit Hamcrest <http://code.google.com/p/hamcrest/>.

-- 
Yours sincerely,
Charles Lee

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message