List of usage examples for java.util Collections singletonList
public static <T> List<T> singletonList(T o)
From source file:tds.assessment.web.endpoints.AccommodationControllerTest.java
@Test public void shouldReturnAccommodationsByAssessmentKey() { Accommodation accommodation = new Accommodation.Builder().build(); when(accommodationsService.findAccommodationsByAssessmentKey("clientName", "key")) .thenReturn(Collections.singletonList(accommodation)); ResponseEntity<List<Accommodation>> response = controller.findAccommodations("clientName", "key", null); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(response.getBody()).containsOnly(accommodation); }
From source file:uk.ac.ebi.eva.pipeline.io.writers.VepInputFlatFileWriterTest.java
@Test public void shouldWriteAllFieldsToFile() throws Exception { ExecutionContext executionContext = MetaDataInstanceFactory.createStepExecution().getExecutionContext(); DBObjectToVariantConverter converter = new DBObjectToVariantConverter(); VariantWrapper variant = new VariantWrapper(converter .convertToDataModelType(JobTestUtils.constructDbo(VariantData.getVariantWithAnnotation()))); File tempFile = JobTestUtils.createTempFile(); VepInputFlatFileWriter writer = new VepInputFlatFileWriter(tempFile); writer.open(executionContext);//w ww. ja va 2 s . c o m writer.write(Collections.singletonList(variant)); assertEquals("20\t60344\t60348\tG/A\t+", readFirstLine(tempFile)); writer.close(); }
From source file:ca.uhn.fhir.rest.method.SinceParameter.java
@Override public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, IBaseResource theTargetResource) throws InternalErrorException { if (theSourceClientArgument != null) { InstantDt since = ParameterUtil.toInstant(theSourceClientArgument); if (since.isEmpty() == false) { theTargetQueryArguments.put(Constants.PARAM_SINCE, Collections.singletonList(since.getValueAsString())); }//from www . ja v a 2 s . com } }
From source file:de.tudarmstadt.ukp.dkpro.argumentation.sequence.feature.meta.AbstractSequenceMetaDataFeatureGenerator.java
@Override public List<Feature> extract(JCas jCas, TextClassificationUnit classificationUnit) throws TextClassificationException { List<String> tags = extractSequence(jCas, classificationUnit); // encode tags to BASE64 String value = encodeToString(tags); Feature feature = new Feature(getMetaDataFeatureName(), value); return Collections.singletonList(feature); }
From source file:com.edduarte.argus.util.PluginLoader.java
private static Stream<Path> filesInDir(Path dir) { if (!dir.toFile().exists()) { return Stream.empty(); }// w w w . j a va 2 s . co m try { return Files.list(dir).flatMap(path -> path.toFile().isDirectory() ? filesInDir(path) : Collections.singletonList(path).stream()); } catch (IOException ex) { throw new RuntimeException(ex); } }
From source file:org.cfg4j.sample.ConfigBeans.java
@Bean public ConfigurationProvider configurationProvider() { // Specify which files to load. Configuration from both files will be merged. ConfigFilesProvider configFilesProvider = () -> Collections.singletonList(Paths.get("application.yaml")); // Use local files as configuration store ConfigurationSource source = new FilesConfigurationSource(configFilesProvider); // Use relative paths Environment environment = new ImmutableEnvironment(filesPath); // Reload configuration every 500 milliseconds ReloadStrategy reloadStrategy = new PeriodicalReloadStrategy(500, TimeUnit.MILLISECONDS); // Create provider return new ConfigurationProviderBuilder().withConfigurationSource(source).withReloadStrategy(reloadStrategy) .withEnvironment(environment).withMetrics(metricRegistry, "firstProvider.").build(); }
From source file:io.pivotal.spring.cloud.service.config.ConfigServerServiceConnectorIntegrationTest.java
@BeforeClass public static void beforeClass() { Mockito.when(MockCloudConnector.instance.isInMatchingCloud()).thenReturn(true); Mockito.when(MockCloudConnector.instance.getServiceInfos()) .thenReturn(Collections.singletonList((ServiceInfo) new ConfigServerServiceInfo("config-server", URI, CLIENT_ID, CLIENT_SECRET, ACCESS_TOKEN_URI))); }
From source file:org.zalando.stups.swagger.codegen.SwaggerCodegenController.java
@RequestMapping(value = "/swagger-resources") public List<SwaggerResource> getResources() { final SwaggerResource swaggerResource = new SwaggerResource(); swaggerResource.setLocation(swaggerCodegenProperties.getLocation()); swaggerResource.setName(swaggerCodegenProperties.getName()); swaggerResource.setSwaggerVersion(swaggerCodegenProperties.getSwaggerVersion()); return Collections.singletonList(swaggerResource); }
From source file:ca.uhn.fhir.rest.method.CountParameter.java
@Override public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, IBaseResource theTargetResource) throws InternalErrorException { if (theSourceClientArgument != null) { IntegerDt since = ParameterUtil.toInteger(theSourceClientArgument); if (since.isEmpty() == false) { theTargetQueryArguments.put(Constants.PARAM_COUNT, Collections.singletonList(since.getValueAsString())); }//from w w w . j a v a2 s. co m } }
From source file:com.orange.cepheus.broker.Util.java
static public ContextElement createTemperatureContextElement(float randomValue) { ContextElement contextElement = new ContextElement(); contextElement.setEntityId(new EntityId("S1", "TempSensor", false)); ContextAttribute contextAttribute = new ContextAttribute("temp", "float", 15.5 + randomValue); contextElement.setContextAttributeList(Collections.singletonList(contextAttribute)); return contextElement; }