Code example for Charset

Methods: encode

0
	 
	@Test 
	public void testDeserialise() throws TTransportException { 
		Consumer<String> consumer = new LoggingTextConsumer(HOSTNAME, PORT, POOL);
		 
		ByteBuffer bytes = utf8.encode(TEST_STRING);
		 
		String test = consumer.deserialise(bytes);
		 
		assertEquals(TEST_STRING, test);
	} 
 
	@Test 
	public void testRun_OneItem() throws NoSuchPool, EmptyPool, TException, InterruptedException { 
		 
		when(mockFactory.createClient(HOSTNAME, PORT)).thenReturn(mockClient);
		 
		// Set message on the queue 
		when(mockClient.acquire(POOL))
			.thenReturn(new Job(utf8.encode(MESSAGE_ONE), utf8.encode(ID_ONE)))
			.thenReturn(new Job(utf8.encode(MESSAGE_TWO), utf8.encode(ID_TWO)))