List of usage examples for java.util Collections singletonList
public static <T> List<T> singletonList(T o)
From source file:com.codepine.api.testrail.internal.ListToCsvSerializerTest.java
@Test public void W_singleElement_T_singleElement() throws IOException { // WHEN/* www . ja v a 2 s . c o m*/ listToCsvSerializer.serialize(Collections.singletonList("a"), jsonGenerator, null); // THEN verify(jsonGenerator).writeString("a"); }
From source file:com.hortonworks.streamline.streams.runtime.transform.SubstituteTransformRuntime.java
@Override public List<StreamlineEvent> execute(StreamlineEvent input) { List<StreamlineEvent> result; try {/* w w w . j a va 2s . c o m*/ result = substitute(input); } catch (Exception ex) { LOG.error("Variable substitution failed", ex); LOG.error("Returning the input event as is without replacing the variables"); result = Collections.singletonList(input); } return result; }
From source file:com.orange.cepheus.cep.EventSinkListenerTest.java
@Before public void setUp() { MockitoAnnotations.initMocks(this); broker = new Broker("http://orion"); broker.setServiceName("SN"); broker.setServicePath("SP"); broker.setAuthToken("AUTH_TOKEN"); Attribute attr = new Attribute("avgTemp", "double"); attr.setMetadata(Collections.singleton(new Metadata("unit", "string"))); // TestConfiguration setup Configuration configuration = new Configuration(); EventTypeOut eventTypeOut = new EventTypeOut("OUT1", "TempSensorAvg", false); eventTypeOut.addBroker(broker);/*from www. j a va 2 s . c o m*/ eventTypeOut.addAttribute(attr); configuration.setEventTypeOuts(Collections.singletonList(eventTypeOut)); eventSinkListener.setConfiguration(configuration); }
From source file:com.realdolmen.rdfleet.service.EmployeeCarServiceTest.java
@Test public void testFindAllNotUsed() { employeeCar2.setCarStatus(CarStatus.NOT_USED); when(employeeCarRepositoryMock.findAllIsNotUsed()) .thenReturn(new ArrayList<>(Collections.singletonList(employeeCar2))); assertEquals(new ArrayList<>(Collections.singletonList(employeeCar2)), employeeCarService.findAllIsNotUsed()); verify(employeeCarRepositoryMock).findAllIsNotUsed(); }
From source file:tds.assessment.web.endpoints.AccommodationControllerTest.java
@Test public void shouldReturnAccommodationsByAssessmentId() { Accommodation accommodation = new Accommodation.Builder().build(); when(accommodationsService.findAccommodationsByAssessmentId("client", "id")) .thenReturn(Collections.singletonList(accommodation)); ResponseEntity<List<Accommodation>> response = controller.findAccommodations("client", null, "id"); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(response.getBody()).containsOnly(accommodation); }
From source file:com.hp.autonomy.aci.content.fieldtext.Specifier.java
/** * Creates a new specifier. e.g./*from w ww .j a v a 2 s. c o m*/ * * <pre> new Specifier("OPERATOR", "TITLE", "1 2", "3 4").toString();</pre> * * evaluates to: * * <pre> "OPERATOR{1%202,3%204}:TITLE"</pre> * * @param operator The fieldtext operator of the specifier. * @param field The name of the IDOL field. * @param values A <tt>String...</tt> of field values. */ public Specifier(final String operator, final String field, final String... values) { this(operator, Collections.singletonList(field), toIterable(values)); }
From source file:co.mafiagame.engine.command.StartStashedGameCommand.java
@Override public ResultMessage execute(StartStashedGameCommandContext context) { validate(context);//from w w w. ja v a 2 s. com StashedGame stashedGame = new StashedGame(context.getInterfaceContext(), context.getCitizenNum(), context.getMafiaNum(), context.getDetectiveNum(), context.getDoctorNum()); stashedGameContainer.addGame(stashedGame); int sum = context.getCitizenNum() + context.getMafiaNum() + context.getDetectiveNum() + context.getDoctorNum(); return new ResultMessage(new Message("stashed.game.started") .setOptions(Collections.singletonList(new Option(Constants.CMD.REGISTER))) .setArgs(String.valueOf(context.getCitizenNum()), String.valueOf(context.getMafiaNum()), String.valueOf(context.getDetectiveNum()), String.valueOf(context.getDoctorNum()), String.valueOf(sum)), ChannelType.GENERAL, context.getInterfaceContext()); }
From source file:test.beans.GenericBean.java
public GenericBean(Map<Short, Integer> shortMap, Resource resource) { this.shortMap = shortMap; this.resourceList = Collections.singletonList(resource); }
From source file:hr.fer.zemris.vhdllab.dao.impl.AbstractOwnedEntityDaoTest.java
/** * everything ok. one entity in collection *//*from w w w. j ava 2s.c o m*/ @Test public void findByUser() { OwnedEntityTable entity = setupOwnedEntity("user", "name"); List<OwnedEntityTable> list = Collections.singletonList(entity); assertEquals("lists not equal.", list, dao.findByUser("user")); assertEquals("user id is not case insensitive.", list, dao.findByUser("USER")); }
From source file:org.bozzo.ipplan.web.assembler.SubnetResourceAssemblerTest.java
@Test public void toResources_with_singleton_array_should_return_a_singleton_array() { Subnet subnet = new Subnet(); subnet.setId(1L);/*w w w .j a va2 s. c om*/ subnet.setDescription("Test description 3"); subnet.setInfraId(1); subnet.setGroup("group"); subnet.setIp(0xC1A80000L); subnet.setSize(65535L); subnet.setLastModifed(new Date()); subnet.setOptionId(1L); subnet.setSwipMod(new Date()); subnet.setUserId("user"); List<SubnetResource> resources = this.assembler.toResources(Collections.singletonList(subnet)); Assert.assertNotNull(resources); Assert.assertEquals(1, resources.size()); Assert.assertTrue(ResourceSupport.class.isAssignableFrom(resources.get(0).getClass())); }