@Test public void testParseInt() { String input; input = "0"; Assert.assertEquals(ParseHelper.parseInt(input), 0); input = "-1"; Assert.assertEquals(ParseHelper.parseInt(input), -1); input = "1"; Assert.assertEquals(ParseHelper.parseInt(input), 1); Assert.assertEquals(ParseHelper.parseInt(null), 0); input = "null"; Assert.assertEquals(ParseHelper.parseInt(input), 0); input = "blah blah"; Assert.assertEquals(ParseHelper.parseInt(input), 0); }
public static int parseInt(String attributeValue) { int number; if (ProteusConstants.DATA_NULL.equals(attributeValue)) { return 0; } try { number = Integer.parseInt(attributeValue); } catch (NumberFormatException e) { if (ProteusConstants.isLoggingEnabled()) { Log.e(TAG, attributeValue + " is NAN. Error: " + e.getMessage()); } number = 0; } return number; }
ParseHelper { public static int parseInt(String attributeValue) { int number; if (ProteusConstants.DATA_NULL.equals(attributeValue)) { return 0; } try { number = Integer.parseInt(attributeValue); } catch (NumberFormatException e) { if (ProteusConstants.isLoggingEnabled()) { Log.e(TAG, attributeValue + " is NAN. Error: " + e.getMessage()); } number = 0; } return number; } }
ParseHelper { public static int parseInt(String attributeValue) { int number; if (ProteusConstants.DATA_NULL.equals(attributeValue)) { return 0; } try { number = Integer.parseInt(attributeValue); } catch (NumberFormatException e) { if (ProteusConstants.isLoggingEnabled()) { Log.e(TAG, attributeValue + " is NAN. Error: " + e.getMessage()); } number = 0; } return number; }  }
ParseHelper { public static int parseInt(String attributeValue) { int number; if (ProteusConstants.DATA_NULL.equals(attributeValue)) { return 0; } try { number = Integer.parseInt(attributeValue); } catch (NumberFormatException e) { if (ProteusConstants.isLoggingEnabled()) { Log.e(TAG, attributeValue + " is NAN. Error: " + e.getMessage()); } number = 0; } return number; }  static int parseInt(String attributeValue); static IntResult parseIntUnsafe(String s); static float parseFloat(String value); static double parseDouble(String attributeValue); static int parseGravity(String value); static Primitive getGravity(String value); static int parseDividerMode(String attributeValue); static Enum parseEllipsize(String attributeValue); static int parseVisibility(@Nullable Value value); static Primitive getVisibility(int visibility); static int parseColor(String color); static boolean parseBoolean(@Nullable Value value); static int parseRelativeLayoutBoolean(boolean value); static void addRelativeLayoutRule(View view, int verb, int anchor); static int parseTextStyle(String attributeValue); static boolean isTweenAnimationResource(String attributeValue); static int getResId(Exception e); }
ParseHelper { public static int parseInt(String attributeValue) { int number; if (ProteusConstants.DATA_NULL.equals(attributeValue)) { return 0; } try { number = Integer.parseInt(attributeValue); } catch (NumberFormatException e) { if (ProteusConstants.isLoggingEnabled()) { Log.e(TAG, attributeValue + " is NAN. Error: " + e.getMessage()); } number = 0; } return number; }  static int parseInt(String attributeValue); static IntResult parseIntUnsafe(String s); static float parseFloat(String value); static double parseDouble(String attributeValue); static int parseGravity(String value); static Primitive getGravity(String value); static int parseDividerMode(String attributeValue); static Enum parseEllipsize(String attributeValue); static int parseVisibility(@Nullable Value value); static Primitive getVisibility(int visibility); static int parseColor(String color); static boolean parseBoolean(@Nullable Value value); static int parseRelativeLayoutBoolean(boolean value); static void addRelativeLayoutRule(View view, int verb, int anchor); static int parseTextStyle(String attributeValue); static boolean isTweenAnimationResource(String attributeValue); static int getResId(Exception e);  }