當前位置: 首頁>>代碼示例>>Java>>正文


Java Description.appendValue方法代碼示例

本文整理匯總了Java中org.hamcrest.Description.appendValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Description.appendValue方法的具體用法?Java Description.appendValue怎麽用?Java Description.appendValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hamcrest.Description的用法示例。


在下文中一共展示了Description.appendValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: used

import org.hamcrest.Description; //導入方法依賴的package包/類
private static Matcher<UsedJourneys> used(Journey journey) {
	return new TypeSafeMatcher<UsedJourneys>() {

		@Override
		public void describeTo(Description description) {
			description.appendText("used");
			description.appendValue(journey);
		}

		@Override
		protected boolean matchesSafely(UsedJourneys journeys) {
			return journeys.used(journey);
		}

		@Override
		protected void describeMismatchSafely(UsedJourneys item, Description mismatchDescription) {
			mismatchDescription.appendText("not used");
			mismatchDescription.appendValue(journey);
		}
	};
}
 
開發者ID:mobitopp,項目名稱:connection-scan,代碼行數:22,代碼來源:DefaultUsedJourneysTest.java

示例2: notUsed

import org.hamcrest.Description; //導入方法依賴的package包/類
private static Matcher<UsedJourneys> notUsed(Journey journey) {
	return new TypeSafeMatcher<UsedJourneys>() {

		@Override
		public void describeTo(Description description) {
			description.appendText("not used");
			description.appendValue(journey);
		}

		@Override
		protected boolean matchesSafely(UsedJourneys journeys) {
			return !journeys.used(journey);
		}

		@Override
		protected void describeMismatchSafely(UsedJourneys item, Description mismatchDescription) {
			mismatchDescription.appendText("used");
			mismatchDescription.appendValue(journey);
		}
	};
}
 
開發者ID:mobitopp,項目名稱:connection-scan,代碼行數:22,代碼來源:DefaultUsedJourneysTest.java

示例3: withIndex

import org.hamcrest.Description; //導入方法依賴的package包/類
private static Matcher<View> withIndex(final Matcher<View> matcher, final int index) {
    return new TypeSafeMatcher<View>() {
        int currentIndex = 0;

        @Override
        public void describeTo(Description description) {
            description.appendText("with index: ");
            description.appendValue(index);
            matcher.describeTo(description);
        }

        @Override
        public boolean matchesSafely(View view) {
            return matcher.matches(view) && currentIndex++ == index;
        }
    };
}
 
開發者ID:aschattney,項目名稱:dagger-test-example,代碼行數:18,代碼來源:SimpleEspressoTest.java

示例4: isAtLeast

import org.hamcrest.Description; //導入方法依賴的package包/類
static Matcher<Api.Version> isAtLeast(final Api.Version lowerBound) {
  return new TypeSafeMatcher<Api.Version>() {
    @Override
    protected boolean matchesSafely(final Api.Version item) {
      return item.ordinal() >= lowerBound.ordinal();
    }

    @Override
    public void describeTo(final Description description) {
      description.appendText("Version is at least");
      description.appendValue(lowerBound);
    }
  };
}
 
開發者ID:honnix,項目名稱:rkt-launcher,代碼行數:15,代碼來源:ApiVersionTestUtils.java

示例5: isAtMost

import org.hamcrest.Description; //導入方法依賴的package包/類
static Matcher<Api.Version> isAtMost(final Api.Version upperBound) {
  return new TypeSafeMatcher<Api.Version>() {
    @Override
    protected boolean matchesSafely(final Api.Version item) {
      return item.ordinal() <= upperBound.ordinal();
    }

    @Override
    public void describeTo(final Description description) {
      description.appendText("Version is at most");
      description.appendValue(upperBound);
    }
  };
}
 
開發者ID:honnix,項目名稱:rkt-launcher,代碼行數:15,代碼來源:ApiVersionTestUtils.java

示例6: is

import org.hamcrest.Description; //導入方法依賴的package包/類
static Matcher<Api.Version> is(final Api.Version version) {
  return new TypeSafeMatcher<Api.Version>() {
    @Override
    protected boolean matchesSafely(final Api.Version item) {
      return item.ordinal() == version.ordinal();
    }

    @Override
    public void describeTo(final Description description) {
      description.appendText("Version can only be");
      description.appendValue(version);
    }
  };
}
 
開發者ID:honnix,項目名稱:rkt-launcher,代碼行數:15,代碼來源:ApiVersionTestUtils.java

示例7: afterLatestDeparture

import org.hamcrest.Description; //導入方法依賴的package包/類
private static Matcher<DefaultConnectionSweeper> afterLatestDeparture(Time time) {
	return new TypeSafeMatcher<DefaultConnectionSweeper>() {

		@Override
		public void describeTo(Description description) {
			description.appendValue(time);
			description.appendText("too late");
		}

		@Override
		protected boolean matchesSafely(DefaultConnectionSweeper connections) {
			return connections.areDepartedBefore(time);
		}
	};
}
 
開發者ID:mobitopp,項目名稱:connection-scan,代碼行數:16,代碼來源:DefaultConnectionSweeperTest.java

示例8: withTextInputLayoutHint

import org.hamcrest.Description; //導入方法依賴的package包/類
public static Matcher<View> withTextInputLayoutHint(final int resourceId) {
    return new BoundedMatcher<View, TextInputLayout>(TextInputLayout.class) {
        private String resourceName = null;
        private String expectedText = null;

        @Override
        public void describeTo(Description description) {
            description.appendText("with string from resource id: ");
            description.appendValue(resourceId);
            if (null != resourceName) {
                description.appendText("[");
                description.appendText(resourceName);
                description.appendText("]");
            }
            if (null != expectedText) {
                description.appendText(" value: ");
                description.appendText(expectedText);
            }
        }

        @Override
        public boolean matchesSafely(TextInputLayout textInputLayout) {
            if (null == expectedText) {
                try {
                    expectedText = textInputLayout.getResources().getString(resourceId);
                    resourceName = textInputLayout.getResources()
                            .getResourceEntryName(resourceId);
                } catch (Resources.NotFoundException ignored) {
                    /* view could be from a context unaware of the resource id. */
                }
            }
            CharSequence actualText = textInputLayout.getHint();
            // FYI: actualText may not be string ... its just a char sequence convert to string.
            return null != expectedText && null != actualText
                    && expectedText.equals(actualText.toString());
        }
    };
}
 
開發者ID:mvescovo,項目名稱:item-reaper,代碼行數:39,代碼來源:CustomMatchers.java

示例9: equalTo

import org.hamcrest.Description; //導入方法依賴的package包/類
/**
 * Gets a hamcrest matcher that tests whether two Ini objects are equal.
 *
 * @param expectedValue
 *          The expected value to core against.
 * @return Method safe matcher that will core field equality.
 */
@Factory
public static TypeSafeMatcher<Ini> equalTo(final Ini expectedValue) {
  return new TypeSafeMatcher<Ini>() {
    @Override
    protected boolean matchesSafely(Ini actualValue) {
      if (expectedValue.size() != actualValue.size()) {
        return false;
      }

      for (Section expectedSection : expectedValue.values()) {
        Section actualSection = actualValue.get(expectedSection.getName());
        if (actualSection == null) {
          return false;
        }

        if (expectedSection.size() != actualSection.size()) {
          return false;
        }

        for (Entry<String,String> expectedEntry : expectedSection.entrySet()) {
          if (!actualSection.containsKey(expectedEntry.getKey())) {
            return false;
          }

          String actual = actualSection.get(expectedEntry.getKey());
          String expected = expectedEntry.getValue();
          if ((actual == null && expected != null) || (actual != null && !actual.equals(expected))) {
            return false;
          }

        }
      }

      return true;
    }

    @Override
    public void describeTo(Description description) {
      description.appendValue(expectedValue);
    }
  };
}
 
開發者ID:mit-ll,項目名稱:PACE,代碼行數:50,代碼來源:Matchers.java

示例10: describeTo

import org.hamcrest.Description; //導入方法依賴的package包/類
@Override
public void describeTo(Description description) {
	description.appendText("ends at ");
	description.appendValue(stop);
}
 
開發者ID:mobitopp,項目名稱:connection-scan,代碼行數:6,代碼來源:EndAt.java

示例11: describeTo

import org.hamcrest.Description; //導入方法依賴的package包/類
@Override
public void describeTo(Description description) {
	description.appendText("part of ");
	description.appendValue(journey);
}
 
開發者ID:mobitopp,項目名稱:connection-scan,代碼行數:6,代碼來源:PartOf.java

示例12: describeMismatchSafely

import org.hamcrest.Description; //導入方法依賴的package包/類
@Override
protected void describeMismatchSafely(Connection connection, Description mismatchDescription) {
	mismatchDescription.appendText("part of ");
	mismatchDescription.appendValue(connection.journey());
}
 
開發者ID:mobitopp,項目名稱:connection-scan,代碼行數:6,代碼來源:PartOf.java

示例13: describeTo

import org.hamcrest.Description; //導入方法依賴的package包/類
@Override
public void describeTo(Description description) {
	description.appendText("has id ");
	description.appendValue(id);
}
 
開發者ID:mobitopp,項目名稱:connection-scan,代碼行數:6,代碼來源:HasId.java

示例14: describeMismatchSafely

import org.hamcrest.Description; //導入方法依賴的package包/類
@Override
protected void describeMismatchSafely(Connection item, Description mismatchDescription) {
	mismatchDescription.appendText("has id ");
	mismatchDescription.appendValue(item.id());
}
 
開發者ID:mobitopp,項目名稱:connection-scan,代碼行數:6,代碼來源:HasId.java

示例15: describeTo

import org.hamcrest.Description; //導入方法依賴的package包/類
@Override
public void describeTo(Description description) {
	description.appendText("arrives at ");
	description.appendValue(arrival);
}
 
開發者ID:mobitopp,項目名稱:connection-scan,代碼行數:6,代碼來源:ArriveAt.java


注:本文中的org.hamcrest.Description.appendValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。