CarpaccioManager implements MappingManager.MappingManagerCallback { public boolean isCarpaccioControlledView(View view) { if (view.getTag() != null) { String tag = view.getTag().toString(); return !tag.isEmpty() && tag.contains("(") && tag.contains(")"); } else if (view instanceof TextView && ((TextView) view).getText() != null) { String text = ((TextView) view).getText().toString(); return !text.isEmpty() && text.trim().startsWith("$"); } else return false; } CarpaccioManager(MappingManager mappingManager); void addView(View view); boolean isCarpaccioControlledView(View view); void registerController(Object controller); void registerControllers(Context context, String registerString); void executeActionsOnViews(); void executeActionsOnViews(List<View> views, Object mappedObject); void executeActionsOnView(View view); void executeActionsOnView(View view, Object mappedObject); void callActionOnView(CarpaccioAction action, View view); void mapObject(String name, Object object); Object getMappedObject(String name); void mapList(String mappedName, List list); void appendList(String mappedName, List list); List getMappedList(String name); Object registerAdapter(String mapName, Object adapter); T getAdapter(String mappedName); void addChildViews(View view); Object bindView(View view, String mapName, int position); Object bindView(View view, String mapName); void notifyAdapterDataSetChanded(Object adapter); void findCarpaccioControlledViews(View view); void findCarpaccioControlledViews(View view, List<View> listAddTo);  }
@Test public void testIsCarpaccioControlledView() throws Exception { View view = mock(View.class); doReturn("setColor()").when(view).getTag(); assertTrue(carpaccioManager.isCarpaccioControlledView(view)); }
@Test public void testIsCarpaccioControlledView_textView() throws Exception { TextView view = mock(TextView.class); doReturn("$user.getName()").when(view).getText(); assertTrue(carpaccioManager.isCarpaccioControlledView(view)); }
@Test public void testIsCarpaccioControlledView_column() throws Exception { View view = mock(View.class); doReturn("setColor();").when(view).getTag(); assertTrue(carpaccioManager.isCarpaccioControlledView(view)); }
@Test public void testIsCarpaccioControlledView_multiple() throws Exception { View view = mock(View.class); doReturn("setColor();setText();").when(view).getTag(); assertTrue(carpaccioManager.isCarpaccioControlledView(view)); }
@Test public void testIsCarpaccioControlledView_false() throws Exception { View view = mock(View.class); doReturn("setColor").when(view).getTag(); assertFalse(carpaccioManager.isCarpaccioControlledView(view)); }
@Test public void testIsCarpaccioControlledView_false_emptyTag() throws Exception { View view = mock(View.class); doReturn(null).when(view).getTag(); assertFalse(carpaccioManager.isCarpaccioControlledView(view)); }