<commit_before>package org.xmpp.packet;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import org.junit.Test;

/**
 * When composing JIDs, two delimiter characters can be used:
 * <ul>
 * <li><tt>@</tt> (at)</li>
 * <li><tt>/</tt> (forward slash)</li>
 * </ul>
 * 
 * Tests in this class verify that usage of those characters as part of the JID is processed correctly.
 * 
 * @author <NAME>, <EMAIL>
 */
public class JIDDelimiterCharsTest {

	/**
	 * Case as reported in TINDER-47
	 */
	@Test
	public void testTINDER47() {
		final JID jid = new JID("a/@b");
		assertNull(jid.getNode());
		assertEquals("a", jid.getDomain());
		assertEquals("@b", jid.getResource());
	}

	/**
	 * Slashes are not allowed in the 'node' part of a JID. Beware that in some cases, "slashes in nodes" are actually
	 * the delimiter separating the domain and resource portions of a JID!
	 */
	@Test(expected = IllegalArgumentException.class)
	public void testSlashInNode_A() {
		new JID("/node@domain.com/resource");
	}

	@Test
	public void testSlashInNode_B() {
		final JID jid = new JID("n/ode@domain.com/resource");
		assertNull(jid.getNode());
		assertEquals("n", jid.getDomain());
		assertEquals("ode<EMAIL>/resource", jid.getResource());
	}

	@Test
	public void testSlashInNode_C() {
		final JID jid = new JID("node/@domain.com/resource");
		assertNull(jid.getNode());
		assertEquals("node", jid.getDomain());
		assertEquals("@domain.com/resource", jid.getResource());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testSlashInNode_D() {
		new JID("//<EMAIL>/resource");
	}

	@Test
	public void testSlashInNode_E() {
		final JID jid = new JID("node//<EMAIL>/resource");
		assertNull(jid.getNode());
		assertEquals("node", jid.getDomain());
		assertEquals("/@domain.com/resource", jid.getResource());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testSlashInNode_F() {
		final JID jid = new JID("no//<EMAIL>/resource");
		assertNull(jid.getNode());
		assertEquals("no", jid.getDomain());
		assertEquals("/<EMAIL>/resource", jid.getResource());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testSlashInNode_G() {
		final JID jid = new JID("n/o/de@domain.<EMAIL>/resource");
		assertNull(jid.getNode());
		assertEquals("n", jid.getDomain());
		assertEquals("o/<EMAIL>/resource", jid.getResource());<commit_msg>Fixing incorrect unit tests. (TINDER-47)<commit_after>package org.xmpp.packet;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import org.junit.Test;

/**
 * When composing JIDs, two delimiter characters can be used:
 * <ul>
 * <li><tt>@</tt> (at)</li>
 * <li><tt>/</tt> (forward slash)</li>
 * </ul>
 * 
 * Tests in this class verify that usage of those characters as part of the JID is processed correctly.
 * 
 * @author <NAME>, <EMAIL>
 */
public class JIDDelimiterCharsTest {

	/**
	 * Case as reported in TINDER-47
	 */
	@Test
	public void testTINDER47() {
		final JID jid = new JID("a/@b");
		assertNull(jid.getNode());
		assertEquals("a", jid.getDomain());
		assertEquals("@b", jid.getResource());
	}

	/**
	 * Slashes are not allowed in the 'node' part of a JID. Beware that in some cases, "slashes in nodes" are actually
	 * the delimiter separating the domain and resource portions of a JID!
	 */
	@Test(expected = IllegalArgumentException.class)
	public void testSlashInNode_A() {
		new JID("/<EMAIL>/resource");
	}

	@Test
	public void testSlashInNode_B() {
		final JID jid = new JID("n/<EMAIL>/resource");
		assertNull(jid.getNode());
		assertEquals("n", jid.getDomain());
		assertEquals("<EMAIL>/resource", jid.getResource());
	}

	@Test
	public void testSlashInNode_C() {
		final JID jid = new JID("node/@domain.com/resource");
		assertNull(jid.getNode());
		assertEquals("node", jid.getDomain());
		assertEquals("@domain.com/resource", jid.getResource());
	}

	@Test(expected = IllegalArgumentException.class)
	public void testSlashInNode_D() {
		new JID("//node@domain.com/resource");
	}

	@Test
	public void testSlashInNode_E() {
		final JID jid = new JID("node//@domain.com/resource");
		assertNull(jid.getNode());
		assertEquals("node", jid.getDomain());
		assertEquals("/@domain.com/resource", jid.getResource());
	}

	@Test
	public void testSlashInNode_F() {
		final JID jid = new JID("no//<EMAIL>/resource");
		assertNull(jid.getNode());
		assertEquals("no", jid.getDomain());
		assertEquals("/<EMAIL>/resource", jid.getResource());
	}

	@Test
	public void testSlashInNode_G() {
		final JID jid = new JID("n/o/de@<EMAIL>/resource");
		assertNull(jid.getNode());
		assertEquals("n", jid.getDomain());
		assertEquals("o/de@domain.com/resource", jid.getResource());
{'fraction_non_alphanumeric': 0.16539601863617112, 'fraction_numerical': 0.0021177467174925877, 'mean_word_length': 4.6159334126040426, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3224106', 'n_tokens_mistral': 1684, 'n_tokens_neox': 1601, 'n_words': 375}