Код: Выделить всё
String source = "XXXXX";
String decrypted = "xxxxx";
Capture byteArrayCapture = Capture.newInstance();
Encrypt encrypt = createMock(Encrypt.class);
EasyMock.expect(encrypt.decryptData(EasyMock.capture(byteArrayCapture))).andReturn(decrypted.getBytes());
replayAll();
String result = sut.decrypt(source);
Assert.assertEquals("b2b2b2b2b2b2b2b2", new String(byteArrayCapture.getValue(), 'UTF-8'));
verifyAll();
resetAll();
Код: Выделить всё
IllegalState 1 matchers expected, 3 recorded. This exception usually occurs when matchers are mixed with raw values when recording a method: foo(5, eq(6)); // wrong You need to use no matcher at all or a matcher for every single param: foo(eq(5), eq(6)); // right foo(5, 6); // also right
Код: Выделить всё
EasyMock.expect(encrypt.decryptData(EasyMock.capture(byteArrayCapture))).andReturn(decrypted.getBytes());
Подробнее здесь: https://stackoverflow.com/questions/792 ... 3-recorded