isNotEmpty(); return toAssert(actual.iterator().next(), navigationDescription("check first element"));
@Test public void testNoCommandsWhenLoadedFromEmptyClassloader() { ClassLoader classLoader = new URLClassLoader(new URL[0], null); // We see the implementation from the classpath loader = new ServiceCommandFactoryLoader(classLoader); assertThat(loader.lookup()).isNotEmpty(); }
isNotEmpty(); return toAssert(actual.iterator().next(), navigationDescription("check first element"));
isNotEmpty(); assertThat(index).describedAs(navigationDescription("check index validity")) .isBetween(0, IterableUtil.sizeOf(actual) - 1);
@Test public void testStartingApplicationInRedeployModeWithFileConf2() throws IOException { cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf=" + new File("src/test/resources/conf.json").getAbsolutePath() }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getString("name")).isEqualTo("vertx"); }
@Test public void testStartingApplicationInRedeployModeWithFileConf() throws IOException { cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf", new File("src/test/resources/conf.json").getAbsolutePath() }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getString("name")).isEqualTo("vertx"); }
isNotEmpty(); assertThat(index).describedAs(navigationDescription("check index validity")) .isBetween(0, IterableUtil.sizeOf(actual) - 1);
isNotEmpty(); return toAssert(lastElement(), navigationDescription("check last element"));
@Test public void testStartingApplicationInRedeployModeWithInlineConf2() throws IOException { int random = (int) (Math.random() * 100); cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf={\"random\":" + random + "}" }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getInteger("random")).isEqualTo(random); }
@Test public void testStartingApplicationInRedeployModeWithInlineConf() throws IOException { int random = (int) (Math.random() * 100); cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf", "{\"random\":" + random + "}" }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getInteger("random")).isEqualTo(random); }
isNotEmpty(); return toAssert(lastElement(), navigationDescription("check last element"));
@Test public void testChangeSetCompleteCallbacksIsNotEmptyWithInsertBeforeMount() { final RecyclerView recyclerView = mock(RecyclerView.class); final ChangeSetCompleteCallback changeSetCompleteCallback = mock(ChangeSetCompleteCallback.class); final RecyclerBinder recyclerBinder = new RecyclerBinder.Builder().rangeRatio(RANGE_RATIO).build(mComponentContext); final ArrayList<RenderInfo> renderInfos = new ArrayList<>(); for (int i = 0; i < 5; i++) { final Component component = TestDrawableComponent.create(mComponentContext).widthPx(100).heightPx(100).build(); renderInfos.add(ComponentRenderInfo.create().component(component).build()); } recyclerBinder.insertRangeAt(0, renderInfos); recyclerBinder.notifyChangeSetComplete(true, changeSetCompleteCallback); // Mount view after insertions recyclerBinder.mount(recyclerView); assertThat(recyclerBinder.mDataRenderedCallbacks).isNotEmpty(); }
@Test public void testChangeSetCompleteCallbacksIsNotEmptyWithAsyncInsertBeforeMount() { final RecyclerView recyclerView = mock(RecyclerView.class); final ChangeSetCompleteCallback changeSetCompleteCallback = mock(ChangeSetCompleteCallback.class); final RecyclerBinder recyclerBinder = new RecyclerBinder.Builder().rangeRatio(RANGE_RATIO).build(mComponentContext); final ArrayList<RenderInfo> renderInfos = new ArrayList<>(); for (int i = 0; i < 5; i++) { final Component component = TestDrawableComponent.create(mComponentContext).widthPx(100).heightPx(100).build(); renderInfos.add(ComponentRenderInfo.create().component(component).build()); } recyclerBinder.insertRangeAtAsync(0, renderInfos); recyclerBinder.notifyChangeSetCompleteAsync(true, changeSetCompleteCallback); recyclerBinder.measure( new Size(), makeSizeSpec(1000, EXACTLY), makeSizeSpec(1000, EXACTLY), null); mLayoutThreadShadowLooper.runToEndOfTasks(); // Mount view after insertions recyclerBinder.mount(recyclerView); assertThat(recyclerBinder.mDataRenderedCallbacks).isNotEmpty(); }
.doesNotContain(testElt5) .hasSize(3) .isNotEmpty(); assertThat(checkIterator(set)).isTrue();
@Test public void testNoCommandsWhenLoadedFromEmptyClassloader() { ClassLoader classLoader = new URLClassLoader(new URL[0], null); // We see the implementation from the classpath loader = new ServiceCommandFactoryLoader(classLoader); assertThat(loader.lookup()).isNotEmpty(); }
@Test public void testStartingApplicationInRedeployModeWithFileConf() throws IOException { cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf", new File("src/test/resources/conf.json").getAbsolutePath() }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getString("name")).isEqualTo("vertx"); }
@Test public void testStartingApplicationInRedeployModeWithFileConf2() throws IOException { cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf=" + new File("src/test/resources/conf.json").getAbsolutePath() }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getString("name")).isEqualTo("vertx"); }
@Test public void testStartingApplicationInRedeployModeWithInlineConf() throws IOException { int random = (int) (Math.random() * 100); cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf", "{\"random\":" + random + "}" }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getInteger("random")).isEqualTo(random); }
@Test public void testStartingApplicationInRedeployModeWithInlineConf2() throws IOException { int random = (int) (Math.random() * 100); cli.dispatch(new Launcher(), new String[]{"run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf={\"random\":" + random + "}" }); assertWaitUntil(() -> { try { return RunCommandTest.getHttpCode() == 200; } catch (IOException e) { return false; } }); JsonObject conf = RunCommandTest.getContent().getJsonObject("conf"); assertThat(conf).isNotNull().isNotEmpty(); assertThat(conf.getInteger("random")).isEqualTo(random); }
@Test(groups = "short", dataProvider = "newKeyspaceName") public void should_notify_of_keyspace_drop(String keyspace) throws InterruptedException { execute(CREATE_KEYSPACE, keyspace); for (SchemaChangeListener listener : listeners) { ArgumentCaptor<KeyspaceMetadata> added = ArgumentCaptor.forClass(KeyspaceMetadata.class); verify(listener, timeout(NOTIF_TIMEOUT_MS).times(1)).onKeyspaceAdded(added.capture()); assertThat(added.getValue()).hasName(handleId(keyspace)); } for (Metadata m : metadatas()) assertThat(m.getReplicas(keyspace, Bytes.fromHexString("0xCAFEBABE"))).isNotEmpty(); execute(CREATE_TABLE, keyspace); // to test table drop notifications execute(DROP_KEYSPACE, keyspace); for (SchemaChangeListener listener : listeners) { ArgumentCaptor<TableMetadata> table = ArgumentCaptor.forClass(TableMetadata.class); verify(listener, timeout(NOTIF_TIMEOUT_MS).times(1)).onTableRemoved(table.capture()); assertThat(table.getValue()).hasName("table1").isInKeyspace(handleId(keyspace)); ArgumentCaptor<KeyspaceMetadata> ks = ArgumentCaptor.forClass(KeyspaceMetadata.class); verify(listener, timeout(NOTIF_TIMEOUT_MS).times(1)).onKeyspaceRemoved(ks.capture()); assertThat(ks.getValue()).hasName(handleId(keyspace)); } for (Metadata m : metadatas()) { assertThat(m.getKeyspace(keyspace)).isNull(); assertThat(m.getReplicas(keyspace, Bytes.fromHexString("0xCAFEBABE"))).isEmpty(); } }