Unit testing with easyMock
Last Updated: Apr 15 2014 14:50, Started by
piramyd
, Apr 15 2014 14:50
·
0
#1
Posted 15 April 2014 - 14:50
Am asa ceva intr-un test:
A a = createNiceMock(A.class); B b = createNiceMock(B.class); expect(b.getId()).andReturn(31130L).anyTimes(); expect(a.getId()).andReturn((long)2).anyTimes(); //expect(a.needsR()).andReturn(false).anyTimes(); expect(a.getB()).andReturn(; replay(a); replay(; assert(C.isTrue(a)); Problema mea: in metoda a.getB() exista un apel catre metoda a.needsR(). Insa si daca las linia de mai sus comentata si daca nu o las, tot imi spune ca nu ma astept sa se apeleze needsR (java.lang.IllegalStateException: missing behavior definition for the preceding method call: A.needsReload()). In C.isTrue(a) se intampla doar asta: return a.getId()==2 && a.getB().getId() == 31130; Intrebare: cand zic: expect(a.getB()).andReturn(; se apeleaza getB() si acolo oare sa fie problema? Please help! |
Anunturi
Bun venit pe Forumul Softpedia!
▶ 0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users