private static void assertTestRunnableStates(boolean[] states, TestRunnable[] testRunnables) { for (int i = 0; i < testRunnables.length; i++) { assertThat(testRunnables[i].hasRun).isEqualTo(states[i]); } }
/** Asserts that window properties {@link Window}.isDynamic are set correctly. */ public static void assertWindowIsDynamic(Timeline timeline, boolean... windowIsDynamic) { Window window = new Window(); for (int i = 0; i < timeline.getWindowCount(); i++) { timeline.getWindow(i, window, true); assertThat(window.isDynamic).isEqualTo(windowIsDynamic[i]); } }
@Test public void asBoolean() { Target target = new Target(); boolean expected = context.getResources().getBoolean(R.bool.just_true); Unbinder unbinder = new BindBoolTest$Target_ViewBinding(target, context); assertThat(target.actual).isEqualTo(expected); unbinder.unbind(); assertThat(target.actual).isEqualTo(expected); } }
private static void assertSleepingStates(boolean[] states, SleeperThread[] sleeperThreads) { for (int i = 0; i < sleeperThreads.length; i++) { assertThat(sleeperThreads[i].isSleeping()).isEqualTo(states[i]); } }
static void assertStronglyEquivalent(Graph<?> graphA, Graph<?> graphB) { // Properties not covered by equals() assertThat(graphA.allowsSelfLoops()).isEqualTo(graphB.allowsSelfLoops()); assertThat(graphA.nodeOrder()).isEqualTo(graphB.nodeOrder()); assertThat(graphA).isEqualTo(graphB); }
static void assertStronglyEquivalent(ValueGraph<?, ?> graphA, ValueGraph<?, ?> graphB) { // Properties not covered by equals() assertThat(graphA.allowsSelfLoops()).isEqualTo(graphB.allowsSelfLoops()); assertThat(graphA.nodeOrder()).isEqualTo(graphB.nodeOrder()); assertThat(graphA).isEqualTo(graphB); }
static void assertStronglyEquivalent(Network<?, ?> networkA, Network<?, ?> networkB) { // Properties not covered by equals() assertThat(networkA.allowsParallelEdges()).isEqualTo(networkB.allowsParallelEdges()); assertThat(networkA.allowsSelfLoops()).isEqualTo(networkB.allowsSelfLoops()); assertThat(networkA.nodeOrder()).isEqualTo(networkB.nodeOrder()); assertThat(networkA.edgeOrder()).isEqualTo(networkB.edgeOrder()); assertThat(networkA).isEqualTo(networkB); }
@Test public void shouldConvertFromMethodSignature() throws Exception { InvocationProfile profile = new InvocationProfile("android/view/View/invalidate()V", false, getClass().getClassLoader()); assertThat(profile.clazz).isEqualTo(View.class); assertThat(profile.methodName).isEqualTo("invalidate"); assertThat(profile.isStatic).isEqualTo(false); assertThat(profile.paramTypes).isEmpty(); }
@Before public void setUp() { ShadowAccessibilityWindowInfo.resetObtainedInstances(); assertThat(ShadowAccessibilityWindowInfo.areThereUnrecycledWindows(true)).isEqualTo(false); window = ShadowAccessibilityWindowInfo.obtain(); assertThat(window == null).isEqualTo(false); shadow = shadowOf(window); }
/** Asserts that window properties {@link Window}.isDynamic are set correctly. */ public static void assertWindowIsDynamic(Timeline timeline, boolean... windowIsDynamic) { Window window = new Window(); for (int i = 0; i < timeline.getWindowCount(); i++) { timeline.getWindow(i, window, true); assertThat(window.isDynamic).isEqualTo(windowIsDynamic[i]); } }
@Test public void shouldHaveCookieWhenCookieIsSet() { cookieManager.setCookie(url, "name=value; Expires=Wed, 09 Jun 2021 10:18:14 GMT"); assertThat(cookieManager.hasCookies()).isEqualTo(true); }
@Test public void testJavaScriptEnabled() { for (boolean value : TRUE_AND_FALSE) { webSettings.setJavaScriptEnabled(value); assertThat(webSettings.getJavaScriptEnabled()).isEqualTo(value); } }
/** * @since version3.4.6 */ @Test public void testTwoProducerSameGroupAndInstanceName() { RMQNormalProducer producer1 = getProducer(nsAddr, topic); assertThat(producer1.isStartSuccess()).isEqualTo(true); RMQNormalProducer producer2 = getProducer(nsAddr, topic, producer1.getProducerGroupName(), producer1.getProducerInstanceName()); assertThat(producer2.isStartSuccess()).isEqualTo(false); }
/** * @since version3.4.6 */ @Test public void testTwoProducerSameGroup() { RMQNormalProducer producer1 = getProducer(nsAddr, topic); assertThat(producer1.isStartSuccess()).isEqualTo(true); RMQNormalProducer producer2 = getProducer(nsAddr, topic, producer1.getProducerGroupName(), RandomUtils.getStringByUUID()); assertThat(producer2.isStartSuccess()).isEqualTo(true); }
@Test public void getAttributeValue_byName_shouldReturnValueFromAttribute() throws Exception { AttributeSet roboAttributeSet = Robolectric.buildAttributeSet() .addAttribute(R.attr.isSugary, "oh heck yeah") .build(); assertThat(roboAttributeSet.getAttributeValue(APP_NS, "isSugary")) .isEqualTo("false"); assertThat(roboAttributeSet.getAttributeBooleanValue(APP_NS, "isSugary", true)) .isEqualTo(false); assertThat(roboAttributeSet.getAttributeBooleanValue(APP_NS, "animalStyle", true)) .isEqualTo(true); }
private void assertReadBitsToEnd(int expectedStartPosition) { int position = testArray.getPosition(); assertThat(position).isEqualTo(expectedStartPosition); for (int i = position; i < TEST_DATA.length * 8; i++) { assertThat(testArray.readBit()).isEqualTo(getTestDataBit(i)); assertThat(testArray.getPosition()).isEqualTo(i + 1); } }
private static void assertCancelled(AbstractFuture<Integer> future, boolean expectWasInterrupted) throws InterruptedException, TimeoutException, ExecutionException { assertDone(future); assertThat(future.isCancelled()).isTrue(); assertThat(future.wasInterrupted()).isEqualTo(expectWasInterrupted); try { getDone(future); fail(); } catch (CancellationException expected) { } try { getDoneFromTimeoutOverload(future); fail(); } catch (CancellationException expected) { } }
@After public void validateGraphState() { assertStronglyEquivalent(graph, Graphs.copyOf(graph)); assertStronglyEquivalent(graph, ImmutableValueGraph.copyOf(graph)); Graph<Integer> asGraph = graph.asGraph(); AbstractGraphTest.validateGraph(asGraph); assertThat(graph.nodes()).isEqualTo(asGraph.nodes()); assertThat(graph.edges()).isEqualTo(asGraph.edges()); assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder()); assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected()); assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops()); for (Integer node : graph.nodes()) { assertThat(graph.adjacentNodes(node)).isEqualTo(asGraph.adjacentNodes(node)); assertThat(graph.predecessors(node)).isEqualTo(asGraph.predecessors(node)); assertThat(graph.successors(node)).isEqualTo(asGraph.successors(node)); assertThat(graph.degree(node)).isEqualTo(asGraph.degree(node)); assertThat(graph.inDegree(node)).isEqualTo(asGraph.inDegree(node)); assertThat(graph.outDegree(node)).isEqualTo(asGraph.outDegree(node)); for (Integer otherNode : graph.nodes()) { boolean hasEdge = graph.hasEdgeConnecting(node, otherNode); assertThat(hasEdge).isEqualTo(asGraph.hasEdgeConnecting(node, otherNode)); assertThat(graph.edgeValueOrDefault(node, otherNode, null) != null).isEqualTo(hasEdge); assertThat(!graph.edgeValueOrDefault(node, otherNode, DEFAULT).equals(DEFAULT)) .isEqualTo(hasEdge); } } }
@Test public void testSendOneQueue() { int msgSize = 20; List<MessageQueue> mqs = producer.getMessageQueue(); MessageQueueMsg mqMsgs = new MessageQueueMsg(MQMessageFactory.getMessageQueues(mqs.get(0)), msgSize); producer.send(mqMsgs.getMsgsWithMQ()); consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())) .containsExactlyElementsIn(mqMsgs.getMsgBodys()); assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs())) .isEqualTo(true); }
@Test public void testOrderMsg() { int msgSize = 10; List<MessageQueue> mqs = producer.getMessageQueue(); MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize); producer.send(mqMsgs.getMsgsWithMQ()); consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())) .containsExactlyElementsIn(mqMsgs.getMsgBodys()); assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs())) .isEqualTo(true); }