Tries to fix the tests which didn't take the encoding into account and started failing after the OperationSetBasicInstantMessaging started looking at the encodings.

cusax-fix
Lyubomir Marinov 17 years ago
parent 7562dd0052
commit 2cb40da4ee

@ -6,12 +6,11 @@
*/
package net.java.sip.communicator.slick.protocol.gibberish;
import java.net.*;
import java.io.*;
import java.util.*;
import junit.framework.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.Message;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
@ -367,6 +366,7 @@ public void testCreateMessage1()
* inspects its parameters.
*/
public void testCreateMessage2()
throws UnsupportedEncodingException
{
String body = "This is an IM coming from the tested implementation"
+ " on " + new Date().toString();
@ -375,11 +375,12 @@ public void testCreateMessage2()
String subject = "test message";
net.java.sip.communicator.service.protocol.Message msg =
opSetBasicIM1.createMessage(body, contentType, encoding, subject);
byte[] bodyBytes = body.getBytes(encoding);
assertEquals("message body", body, msg.getContent());
assertTrue("message body bytes"
, Arrays.equals(body.getBytes(), msg.getRawData()));
assertEquals("message length", body.length(), msg.getSize());
, Arrays.equals(bodyBytes, msg.getRawData()));
assertEquals("message length", bodyBytes.length, msg.getSize());
assertEquals("message content type", contentType, msg.getContentType());
assertEquals("message encoding", encoding, msg.getEncoding());
assertNotNull("message uid", msg.getMessageUID());

@ -6,6 +6,7 @@
*/
package net.java.sip.communicator.slick.protocol.jabber;
import java.io.*;
import java.net.*;
import java.util.*;
@ -370,6 +371,7 @@ public void testCreateMessage1()
* inspects its parameters.
*/
public void testCreateMessage2()
throws UnsupportedEncodingException
{
String body = "This is an IM coming from the tested implementation"
+ " on " + new Date().toString();
@ -378,11 +380,12 @@ public void testCreateMessage2()
String subject = "test message";
net.java.sip.communicator.service.protocol.Message msg =
opSetBasicIM1.createMessage(body, contentType, encoding, subject);
byte[] bodyBytes = body.getBytes(encoding);
assertEquals("message body", body, msg.getContent());
assertTrue("message body bytes"
, Arrays.equals(body.getBytes(), msg.getRawData()));
assertEquals("message length", body.length(), msg.getSize());
, Arrays.equals(bodyBytes, msg.getRawData()));
assertEquals("message length", bodyBytes.length, msg.getSize());
assertEquals("message content type", contentType, msg.getContentType());
assertEquals("message encoding", encoding, msg.getEncoding());
assertNotNull("message uid", msg.getMessageUID());

@ -6,6 +6,7 @@
*/
package net.java.sip.communicator.slick.protocol.msn;
import java.io.*;
import java.net.*;
import java.util.*;
@ -337,6 +338,7 @@ public void testCreateMessage1()
* inspects its parameters.
*/
public void testCreateMessage2()
throws UnsupportedEncodingException
{
String body = "This is an IM coming from the tested implementation"
+ " on " + new Date().toString();
@ -345,11 +347,12 @@ public void testCreateMessage2()
String subject = "test message";
net.java.sip.communicator.service.protocol.Message msg =
opSetBasicIM1.createMessage(body, contentType, encoding, subject);
byte[] bodyBytes = body.getBytes(encoding);
assertEquals("message body", body, msg.getContent());
assertTrue("message body bytes"
, Arrays.equals(body.getBytes(), msg.getRawData()));
assertEquals("message length", body.length(), msg.getSize());
, Arrays.equals(bodyBytes, msg.getRawData()));
assertEquals("message length", bodyBytes.length, msg.getSize());
assertEquals("message content type", contentType, msg.getContentType());
assertEquals("message encoding", encoding, msg.getEncoding());
assertNotNull("message uid", msg.getMessageUID());

@ -6,6 +6,7 @@
*/
package net.java.sip.communicator.slick.protocol.yahoo;
import java.io.*;
import java.net.*;
import java.util.*;
@ -347,6 +348,7 @@ public void testCreateMessage1()
* inspects its parameters.
*/
public void testCreateMessage2()
throws UnsupportedEncodingException
{
String body = "This is an IM coming from the tested implementation"
+ " on " + new Date().toString();
@ -355,11 +357,12 @@ public void testCreateMessage2()
String subject = "test message";
net.java.sip.communicator.service.protocol.Message msg =
opSetBasicIM1.createMessage(body, contentType, encoding, subject);
byte[] bodyBytes = body.getBytes(encoding);
assertEquals("message body", body, msg.getContent());
assertTrue("message body bytes"
, Arrays.equals(body.getBytes(), msg.getRawData()));
assertEquals("message length", body.length(), msg.getSize());
, Arrays.equals(bodyBytes, msg.getRawData()));
assertEquals("message length", bodyBytes.length, msg.getSize());
assertEquals("message content type", contentType, msg.getContentType());
assertEquals("message encoding", encoding, msg.getEncoding());
assertNotNull("message uid", msg.getMessageUID());

Loading…
Cancel
Save