Java Code Examples for com.hippo.yorozuya.AssertUtils#assertEquals()
The following examples show how to use
com.hippo.yorozuya.AssertUtils#assertEquals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FabLayout.java From MHViewer with Apache License 2.0 | 6 votes |
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { AssertUtils.assertEquals("Measure mode must be MeasureSpec.EXACTLY", MeasureSpec.getMode(widthMeasureSpec), MeasureSpec.EXACTLY); AssertUtils.assertEquals("Measure mode must be MeasureSpec.EXACTLY", MeasureSpec.getMode(heightMeasureSpec), MeasureSpec.EXACTLY); int width = MeasureSpec.getSize(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec( width - getPaddingLeft() - getPaddingRight(), MeasureSpec.AT_MOST); int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec( height - getPaddingTop() - getPaddingBottom(), MeasureSpec.AT_MOST); measureChildren(childWidthMeasureSpec, childHeightMeasureSpec); setMeasuredDimension(width, height); }
Example 2
Source File: DB.java From Nimingban with Apache License 2.0 | 6 votes |
private static void insertDefaultACCommonPosts() { ACCommonPostDao dao = sDaoSession.getACCommonPostDao(); dao.deleteAll(); int size = 13; String[] names = { "人,是会思考的芦苇", "丧尸图鉴", "壁纸楼", "足控福利", "淡定红茶", "胸器福利", "黑妹", "总有一天", "这是芦苇", "赵日天", "二次元女友", "什么鬼", "Banner画廊"}; String[] ids = { "6064422", "585784", "117617", "103123", "114373", "234446", "55255", "328934", "49607", "1738904", "553505", "5739391", "6538597"}; AssertUtils.assertEquals("ids.size must be size", size, ids.length); AssertUtils.assertEquals("names.size must be size", size, names.length); for (int i = 0; i < size; i++) { ACCommonPostRaw raw = new ACCommonPostRaw(); raw.setName(names[i]); raw.setPostid(ids[i]); dao.insert(raw); } }
Example 3
Source File: FabLayout.java From EhViewer with Apache License 2.0 | 6 votes |
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { AssertUtils.assertEquals("Measure mode must be MeasureSpec.EXACTLY", MeasureSpec.getMode(widthMeasureSpec), MeasureSpec.EXACTLY); AssertUtils.assertEquals("Measure mode must be MeasureSpec.EXACTLY", MeasureSpec.getMode(heightMeasureSpec), MeasureSpec.EXACTLY); int width = MeasureSpec.getSize(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec( width - getPaddingLeft() - getPaddingRight(), MeasureSpec.AT_MOST); int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec( height - getPaddingTop() - getPaddingBottom(), MeasureSpec.AT_MOST); measureChildren(childWidthMeasureSpec, childHeightMeasureSpec); setMeasuredDimension(width, height); }
Example 4
Source File: EhEngine.java From MHViewer with Apache License 2.0 | 5 votes |
public static Void addFavoritesRange(@Nullable EhClient.Task task, OkHttpClient okHttpClient, long[] gidArray, String[] tokenArray, int dstCat) throws Throwable { AssertUtils.assertEquals(gidArray.length, tokenArray.length); for (int i = 0, n = gidArray.length; i < n; i++) { addFavorites(task, okHttpClient, gidArray[i], tokenArray[i], dstCat, null); } return null; }
Example 5
Source File: Settings.java From MHViewer with Apache License 2.0 | 5 votes |
public static void putFavCat(String[] value) { AssertUtils.assertEquals(10, value.length); sSettingsPre.edit() .putString(KEY_FAV_CAT_0, value[0]) .putString(KEY_FAV_CAT_1, value[1]) .putString(KEY_FAV_CAT_2, value[2]) .putString(KEY_FAV_CAT_3, value[3]) .putString(KEY_FAV_CAT_4, value[4]) .putString(KEY_FAV_CAT_5, value[5]) .putString(KEY_FAV_CAT_6, value[6]) .putString(KEY_FAV_CAT_7, value[7]) .putString(KEY_FAV_CAT_8, value[8]) .putString(KEY_FAV_CAT_9, value[9]) .apply(); }
Example 6
Source File: Settings.java From MHViewer with Apache License 2.0 | 5 votes |
public static void putFavCount(int[] count) { AssertUtils.assertEquals(10, count.length); sSettingsPre.edit() .putInt(KEY_FAV_COUNT_0, count[0]) .putInt(KEY_FAV_COUNT_1, count[1]) .putInt(KEY_FAV_COUNT_2, count[2]) .putInt(KEY_FAV_COUNT_3, count[3]) .putInt(KEY_FAV_COUNT_4, count[4]) .putInt(KEY_FAV_COUNT_5, count[5]) .putInt(KEY_FAV_COUNT_6, count[6]) .putInt(KEY_FAV_COUNT_7, count[7]) .putInt(KEY_FAV_COUNT_8, count[8]) .putInt(KEY_FAV_COUNT_9, count[9]) .apply(); }
Example 7
Source File: MaxSizeContainer.java From MHViewer with Apache License 2.0 | 5 votes |
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { AssertUtils.assertEquals("getChildCount() must be 1", 1, getChildCount()); View child = getChildAt(0); if (child.getVisibility() != GONE) { child.measure(getMeasureSpec(widthMeasureSpec, mMaxWidth), getMeasureSpec(heightMeasureSpec, mMaxHeight)); setMeasuredDimension(child.getMeasuredWidth(), child.getMeasuredHeight()); } else { setMeasuredDimension(0, 0); } }
Example 8
Source File: MaxSizeContainer.java From MHViewer with Apache License 2.0 | 5 votes |
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { AssertUtils.assertEquals("getChildCount() must be 1", 1, getChildCount()); View child = getChildAt(0); if (child.getVisibility() != GONE) { child.layout(0, 0, r - l, b - t); } }
Example 9
Source File: FavoritesParser.java From EhViewer with Apache License 2.0 | 5 votes |
public static Result parse(String body) throws Exception { if (body.contains("This page requires you to log on.</p>")) { throw new EhException(GetText.getString(R.string.need_sign_in)); } String[] catArray = new String[10]; int[] countArray = new int[10]; try { Document d = Jsoup.parse(body); Element ido = JsoupUtils.getElementByClass(d, "ido"); //noinspection ConstantConditions Elements fps = ido.getElementsByClass("fp"); // Last one is "fp fps" AssertUtils.assertEquals(11, fps.size()); for (int i = 0; i < 10; i++) { Element fp = fps.get(i); countArray[i] = ParserUtils.parseInt(fp.child(0).text(), 0); catArray[i] = ParserUtils.trim(fp.child(2).text()); } } catch (Throwable e) { ExceptionUtils.throwIfFatal(e); e.printStackTrace(); throw new ParseException("Parse favorites error", body); } GalleryListParser.Result result = GalleryListParser.parse(body); Result re = new Result(); re.catArray = catArray; re.countArray = countArray; re.pages = result.pages; re.nextPage = result.nextPage; re.galleryInfoList = result.galleryInfoList; return re; }
Example 10
Source File: EhEngine.java From EhViewer with Apache License 2.0 | 5 votes |
public static Void addFavoritesRange(@Nullable EhClient.Task task, OkHttpClient okHttpClient, long[] gidArray, String[] tokenArray, int dstCat) throws Throwable { AssertUtils.assertEquals(gidArray.length, tokenArray.length); for (int i = 0, n = gidArray.length; i < n; i++) { addFavorites(task, okHttpClient, gidArray[i], tokenArray[i], dstCat, null); } return null; }
Example 11
Source File: Settings.java From EhViewer with Apache License 2.0 | 5 votes |
public static void putFavCat(String[] value) { AssertUtils.assertEquals(10, value.length); sSettingsPre.edit() .putString(KEY_FAV_CAT_0, value[0]) .putString(KEY_FAV_CAT_1, value[1]) .putString(KEY_FAV_CAT_2, value[2]) .putString(KEY_FAV_CAT_3, value[3]) .putString(KEY_FAV_CAT_4, value[4]) .putString(KEY_FAV_CAT_5, value[5]) .putString(KEY_FAV_CAT_6, value[6]) .putString(KEY_FAV_CAT_7, value[7]) .putString(KEY_FAV_CAT_8, value[8]) .putString(KEY_FAV_CAT_9, value[9]) .apply(); }
Example 12
Source File: Settings.java From EhViewer with Apache License 2.0 | 5 votes |
public static void putFavCount(int[] count) { AssertUtils.assertEquals(10, count.length); sSettingsPre.edit() .putInt(KEY_FAV_COUNT_0, count[0]) .putInt(KEY_FAV_COUNT_1, count[1]) .putInt(KEY_FAV_COUNT_2, count[2]) .putInt(KEY_FAV_COUNT_3, count[3]) .putInt(KEY_FAV_COUNT_4, count[4]) .putInt(KEY_FAV_COUNT_5, count[5]) .putInt(KEY_FAV_COUNT_6, count[6]) .putInt(KEY_FAV_COUNT_7, count[7]) .putInt(KEY_FAV_COUNT_8, count[8]) .putInt(KEY_FAV_COUNT_9, count[9]) .apply(); }
Example 13
Source File: MaxSizeContainer.java From EhViewer with Apache License 2.0 | 5 votes |
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { AssertUtils.assertEquals("getChildCount() must be 1", 1, getChildCount()); View child = getChildAt(0); if (child.getVisibility() != GONE) { child.measure(getMeasureSpec(widthMeasureSpec, mMaxWidth), getMeasureSpec(heightMeasureSpec, mMaxHeight)); setMeasuredDimension(child.getMeasuredWidth(), child.getMeasuredHeight()); } else { setMeasuredDimension(0, 0); } }
Example 14
Source File: MaxSizeContainer.java From EhViewer with Apache License 2.0 | 5 votes |
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { AssertUtils.assertEquals("getChildCount() must be 1", 1, getChildCount()); View child = getChildAt(0); if (child.getVisibility() != GONE) { child.layout(0, 0, r - l, b - t); } }