@Test public void testProgramNotFoundErrorMessage() { String expectedMessage = context.getString(R.string.exception_message_program_not_found); String actualMessage = ErrorMessageFactory.create( context, new ProgramNotFoundException() ); assertThat( actualMessage, is( equalTo( expectedMessage ) ) ); }
public static String create( Context context, Exception exception ) { String message = context.getString( R.string.exception_message_generic ); if( exception instanceof NetworkConnectionException ) { message = context.getString( R.string.exception_message_no_connection ); } else if( exception instanceof ProgramNotFoundException ) { message = context.getString( R.string.exception_message_program_not_found ); } return message; }
ErrorMessageFactory { public static String create( Context context, Exception exception ) { String message = context.getString( R.string.exception_message_generic ); if( exception instanceof NetworkConnectionException ) { message = context.getString( R.string.exception_message_no_connection ); } else if( exception instanceof ProgramNotFoundException ) { message = context.getString( R.string.exception_message_program_not_found ); } return message; } }
ErrorMessageFactory { public static String create( Context context, Exception exception ) { String message = context.getString( R.string.exception_message_generic ); if( exception instanceof NetworkConnectionException ) { message = context.getString( R.string.exception_message_no_connection ); } else if( exception instanceof ProgramNotFoundException ) { message = context.getString( R.string.exception_message_program_not_found ); } return message; } private  ErrorMessageFactory(); }
ErrorMessageFactory { public static String create( Context context, Exception exception ) { String message = context.getString( R.string.exception_message_generic ); if( exception instanceof NetworkConnectionException ) { message = context.getString( R.string.exception_message_no_connection ); } else if( exception instanceof ProgramNotFoundException ) { message = context.getString( R.string.exception_message_program_not_found ); } return message; } private  ErrorMessageFactory(); static String create( Context context, Exception exception ); }
ErrorMessageFactory { public static String create( Context context, Exception exception ) { String message = context.getString( R.string.exception_message_generic ); if( exception instanceof NetworkConnectionException ) { message = context.getString( R.string.exception_message_no_connection ); } else if( exception instanceof ProgramNotFoundException ) { message = context.getString( R.string.exception_message_program_not_found ); } return message; } private  ErrorMessageFactory(); static String create( Context context, Exception exception );  }