### Question:
GitAPIExceptionWrapper { public StoreException.TestUpdateException wrapException(final StoreException.TestUpdateException exception) { final Throwable cause = exception.getCause(); if (gitUrl.endsWith(".git")) { if (cause instanceof TransportException) { if (cause.getMessage().contains("not authorized")) { return new GitNoAuthorizationException("Please check your user name and password", exception); } else if (cause.getMessage().contains("git-receive-pack not permitted")) { return new GitNoDevelperAccessLevelException( "Check if your access level is developer in [" + gitUrl.substring(0, gitUrl.length() - 4) + "/project_members]", exception); } else if (cause.getMessage().matches("^50\\d\\s.*")) { return new GitServerErrorException("Check if " + gitUrl + " is available", exception); } } else if (cause instanceof IllegalStateException) { if ("pre-receive hook declined".equals(cause.getMessage())) { return new GitNoMasterAccessLevelException( "Check if your access level is master in [" + gitUrl.substring(0, gitUrl.length() - 4) + "/project_members]", exception); } } } return exception; }  void setGitUrl(final String gitUrl); StoreException.TestUpdateException wrapException(final StoreException.TestUpdateException exception);  }### Answer:
@Test public void testWrapExceptionInGitNoAuthorizationException() { final TestUpdateException exception = getTestUpdateException(NOT_AUTHORIZED_EXCEPTION); final TestUpdateException result = gitAPIExceptionWrapper.wrapException(exception); assertTrue(result instanceof GitNoAuthorizationException); }
@Test public void testWrapExceptionInGitNoDeveloperAccessLevelException() { final TestUpdateException exception = getTestUpdateException(DEVELOPER_ACCESS_LEVEL_EXCEPTION); final TestUpdateException result = gitAPIExceptionWrapper.wrapException(exception); assertTrue(result instanceof GitNoDevelperAccessLevelException); }
@Test public void testWrapExceptionInGitServerErrorException() { { final TestUpdateException exception = getTestUpdateException(SERVER_ERROR_EXCEPTION); final TestUpdateException result = gitAPIExceptionWrapper.wrapException(exception); assertTrue(result instanceof GitServerErrorException); } { final TestUpdateException exception = getTestUpdateException(SERVER_ERROR_EXCEPTION2); final TestUpdateException result = gitAPIExceptionWrapper.wrapException(exception); assertTrue(result instanceof GitServerErrorException); } }
@Test public void testWrapExceptionInGitNoMasterAccessLevelException() { final TestUpdateException exception = getTestUpdateException(MASTER_ACCESS_LEVEL_EXCEPTION); final TestUpdateException result = gitAPIExceptionWrapper.wrapException(exception); assertTrue(result instanceof GitNoMasterAccessLevelException); }