@Test public void whenUnsupportedKeyIsPressed_thenNoCallbacksAreTriggered() { source.onKeyDown(1337); verify(mockListener, times(0)).onNewFace(any(FaceExpression.class)); }
public boolean onKeyDown(int keyCode) { if (sameKeyCodeIsTriggered(keyCode)) { return false; } FaceExpression faceExpression = mappings.getFaceFromKeyCode(keyCode); if (faceExpression != null) { currentExpression = faceExpression; faceListener.onNewFace(faceExpression); return true; } currentExpression = NEUTRAL_EXPRESSION; return false; }
KeyboardFaceSource implements FaceReactionSource { public boolean onKeyDown(int keyCode) { if (sameKeyCodeIsTriggered(keyCode)) { return false; } FaceExpression faceExpression = mappings.getFaceFromKeyCode(keyCode); if (faceExpression != null) { currentExpression = faceExpression; faceListener.onNewFace(faceExpression); return true; } currentExpression = NEUTRAL_EXPRESSION; return false; } }
KeyboardFaceSource implements FaceReactionSource { public boolean onKeyDown(int keyCode) { if (sameKeyCodeIsTriggered(keyCode)) { return false; } FaceExpression faceExpression = mappings.getFaceFromKeyCode(keyCode); if (faceExpression != null) { currentExpression = faceExpression; faceListener.onNewFace(faceExpression); return true; } currentExpression = NEUTRAL_EXPRESSION; return false; } KeyboardFaceSource(FaceTracker.FaceListener faceListener, KeyToFaceMappings mappings); }
KeyboardFaceSource implements FaceReactionSource { public boolean onKeyDown(int keyCode) { if (sameKeyCodeIsTriggered(keyCode)) { return false; } FaceExpression faceExpression = mappings.getFaceFromKeyCode(keyCode); if (faceExpression != null) { currentExpression = faceExpression; faceListener.onNewFace(faceExpression); return true; } currentExpression = NEUTRAL_EXPRESSION; return false; } KeyboardFaceSource(FaceTracker.FaceListener faceListener, KeyToFaceMappings mappings); boolean onKeyDown(int keyCode); boolean onKeyUp(int keyCode); @Override void start(); @Override void release(); }
KeyboardFaceSource implements FaceReactionSource { public boolean onKeyDown(int keyCode) { if (sameKeyCodeIsTriggered(keyCode)) { return false; } FaceExpression faceExpression = mappings.getFaceFromKeyCode(keyCode); if (faceExpression != null) { currentExpression = faceExpression; faceListener.onNewFace(faceExpression); return true; } currentExpression = NEUTRAL_EXPRESSION; return false; } KeyboardFaceSource(FaceTracker.FaceListener faceListener, KeyToFaceMappings mappings); boolean onKeyDown(int keyCode); boolean onKeyUp(int keyCode); @Override void start(); @Override void release();  }