### Question:
OrientationManager implements OrientationOperator { public int getPhotoOrientation() { Characteristics characteristics = cameraConnection.getCharacteristics(); return OrientationUtils.computeImageOrientation( orientation, characteristics.getSensorOrientation(), characteristics.isFrontFacingLens() ); } OrientationManager(CameraConnection cameraConnection); @Override void setDisplayOrientation(int orientation); int getPhotoOrientation(); synchronized void addListener(Listener listener);  }### Answer:
@Test public void back_landscape_0() throws Exception { givenSensor90Degrees(); givenLandscapeScreen(); int orientation = testee.getPhotoOrientation(); assertEquals(0, orientation); }
@Test public void back_portrait_90() throws Exception { givenSensor90Degrees(); givenPortraitScreen(); int orientation = testee.getPhotoOrientation(); assertEquals(270, orientation); }
@Test public void back_reverseLandscape_180() throws Exception { givenSensor90Degrees(); givenReverseLandscapeScreen(); int orientation = testee.getPhotoOrientation(); assertEquals(180, orientation); }
@Test public void back_reversePortrait_270() throws Exception { givenSensor90Degrees(); givenReversePortraitScreen(); int orientation = testee.getPhotoOrientation(); assertEquals(90, orientation); }
@Test public void front_reverseLandscape_0() throws Exception { givenFrontLens(); givenSensor90Degrees(); givenReverseLandscapeScreen(); int orientation = testee.getPhotoOrientation(); assertEquals(0, orientation); }
@Test public void front_portrait_90() throws Exception { givenFrontLens(); givenSensor90Degrees(); givenPortraitScreen(); int orientation = testee.getPhotoOrientation(); assertEquals(270, orientation); }
@Test public void front_landscape_180() throws Exception { givenFrontLens(); givenSensor90Degrees(); givenLandscapeScreen(); int orientation = testee.getPhotoOrientation(); assertEquals(180, orientation); }
@Test public void front_reversePortrait_270() throws Exception { givenFrontLens(); givenSensor90Degrees(); givenReversePortraitScreen(); int orientation = testee.getPhotoOrientation(); assertEquals(90, orientation); }