org.hamcrest.core.StringEndsWith Java Examples
The following examples show how to use
org.hamcrest.core.StringEndsWith.
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: StickyTest.java From cactoos with MIT License | 6 votes |
@Test public void extendsExistingMap() throws Exception { MatcherAssert.assertThat( "Can't extend an existing map", new Sticky<String, String>( new Sticky<String, String>( new MapEntry<>("make", "Mercedes-Benz"), new MapEntry<>("cost", "$95,000") ), new MapEntry<>("year", "2017"), new MapEntry<>("mileage", "12,000") ), new IsMapContaining<>( new IsAnything<>(), new StringEndsWith(",000") ) ); }
Example #2
Source File: ReferenceTextBuilderTest.java From rtg-tools with BSD 2-Clause "Simplified" License | 6 votes |
@Test public void test() throws IOException { final ReferenceTextBuilder builder = ReferenceTextBuilder.createDiploid(); builder.addSequence("foo", Sex.EITHER, Ploidy.DIPLOID, true); builder.addSequence("moo", Sex.MALE, Ploidy.HAPLOID, false); assertEquals(EXPECTED, builder.toString()); try (TestDirectory dir = new TestDirectory()) { final File refText = new File(dir, "someName"); builder.writeToFile(refText); assertEquals(EXPECTED, FileHelper.fileToString(refText)); final File sdf = ReaderTestUtils.getDNADir(">seq\nacagtacgt\n", new File(dir, "sdf")); builder.writeToSdfDir(sdf); assertEquals(EXPECTED, FileHelper.fileToString(new File(sdf, ReferenceGenome.REFERENCE_FILE))); final File notSdf = new File(dir, "notSdf"); assertTrue(notSdf.mkdir()); mExpectedException.expect(IOException.class); mExpectedException.expectMessage(StringEndsWith.endsWith("is not an SDF")); builder.writeToSdfDir(notSdf); } }
Example #3
Source File: FeedCommandIT.java From emissary with Apache License 2.0 | 5 votes |
@Test public void requiredArgumentsDefaultValues() throws Exception { // setup // Add the required parameters arguments.addAll(Arrays.asList(PROJECT_BASE_ARGS[0], baseDir.toString(), INPUT_ARGS[0], inputDir.toString())); // test command = FeedCommand.parse(FeedCommand.class, arguments); // verify required assertThat(command.getPriorityDirectories().size(), equalTo(1)); assertThat(command.getPriorityDirectories().get(0).getDirectoryName(), equalTo(inputDir.toString() + "/")); assertThat(command.getProjectBase(), equalTo(baseDir)); // verify defaults assertThat(command.getBundleSize(), equalTo(1)); assertThat(command.getCaseClass(), equalTo("")); assertThat(command.getCaseId(), equalTo("auto")); assertThat(command.getClientPattern(), equalTo("INITIAL.FILE_PICK_UP_CLIENT.INPUT.*")); assertThat(command.getEatPrefix(), equalTo("")); assertThat(command.getHost(), equalTo("localhost")); assertThat(command.getLogbackConfig(), equalTo(baseDir + "/config/logback.xml")); assertThat(command.getOutputRoot(), StringEndsWith.endsWith("/DoneParsedData")); assertThat(command.getPort(), equalTo(7001)); assertThat(command.getSort(), equalTo(null)); assertThat(command.getWorkspaceClass(), equalTo("emissary.pickup.WorkSpace")); assertThat(command.getWorkspaceName(), equalTo("WorkSpace")); assertThat(command.isFileTimestamp(), equalTo(false)); assertThat(command.isSimple(), equalTo(false)); assertThat(command.isIncludeDirs(), equalTo(false)); assertThat(command.isLoop(), equalTo(true)); assertThat(command.isRetry(), equalTo(true)); assertThat(command.isSkipDotFile(), equalTo(true)); }
Example #4
Source File: StickyTest.java From cactoos with MIT License | 5 votes |
@Test public void decoratesEntries() throws Exception { MatcherAssert.assertThat( "Can't decorate a list of entries", new Sticky<String, String>( new MapEntry<>("first", "Jeffrey"), new MapEntry<>("last", "Lebowski") ), new IsMapContaining<>( new IsAnything<>(), new StringEndsWith("ski") ) ); }
Example #5
Source File: ServerYamlValidityTest.java From triplea with GNU General Public License v3.0 | 5 votes |
@Test void uriValuesDoNotEndInSlash() { liveServers.getServers().stream() .map(ServerProperties::getUri) .filter(Objects::nonNull) .map(URI::toString) .forEach(uriString -> assertThat(uriString, not(StringEndsWith.endsWith("/")))); }
Example #6
Source File: CheckParserUsagesDT.java From sql-layer with GNU Affero General Public License v3.0 | 5 votes |
private static Collection<String> getClassesInPackage(String packageName, String sampleClass) { String sampleClassPathSuffix = sampleClass.replaceAll("\\.", "/") + ".class"; String sampleClassPath = CheckParserUsagesDT.class.getClassLoader().getResource(sampleClassPathSuffix).getPath(); assertThat(sampleClassPath, new StringEndsWith(sampleClassPathSuffix)); String packagePath = sampleClassPath.substring(0,sampleClassPath.length()-sampleClassPathSuffix.length()) + packageName.replaceAll("\\.", "/"); return getAllClassesInDirectory(new File(packagePath)); }
Example #7
Source File: PipeLineTest.java From iaf with Apache License 2.0 | 5 votes |
@Test public void testDuplicateExits() throws ConfigurationException { Adapter adapter = new Adapter(); PipeLine pipeline = new PipeLine(); PipeLineExit exit = new PipeLineExit(); exit.setPath("success"); exit.setState("SUCCESS"); pipeline.registerPipeLineExit(exit); pipeline.registerPipeLineExit(exit); adapter.registerPipeLine(pipeline); String lastWarning = ConfigurationWarnings.getInstance().getLast(); assertThat(lastWarning,StringEndsWith.endsWith("PipeLine exit named [success] already exists")); }