<commit_before>package com.balancedpayments;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.HashMap;

import com.balancedpayments.errors.*;
import org.junit.Test;


public class CallbackTest extends BaseTest {

    @Test
    public void testCallbackCreate() throws HTTPError, NotCreated, NoResultsFound, MultipleResultsFound {
        Callback.Collection callbacks = mp.callbacks;
        int total = callbacks.total();
        assertEquals(0, total);

        HashMap<String, Object> callbackPayload = new HashMap<String, Object>();
        callbackPayload.put("url", "http://www.example.com/cb");
        callbackPayload.put("method", "post");

        Callback callback = new Callback(callbackPayload);
        callback.save();

        callback.reload();
        mp.reload();

        assertEquals(mp.callbacks.total(), 1);
        assertEquals("http://www.example.com/cb", callback.url);
        assertEquals("post", callback.method);

        callback.delete();
        mp.reload();

        assertEquals(mp.callbacks.total(), 0);
    }

    @Test
    public void testCallbacksResourceFields() throws HTTPError {
        HashMap<String, Object> payload = new HashMap<String, Object>();
        payload.put("url", "http://www.example.com/callback");
        payload.put("method", "post");

        Callback callback = new Callback(payload);
        callback.save();

        assertNotNull(callback.href);
        assertNotNull(callback.id);
        assertNotNull(callback.links);
        assertNotNull(callback.method);
        assertNotNull(callback.revision);
        assertNotNull(callback.url);
    }
}<commit_msg>Add specific assertions to callbacks<commit_after>package com.balancedpayments;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.HashMap;

import com.balancedpayments.errors.*;
import org.junit.Test;


public class CallbackTest extends BaseTest {

    @Test
    public void testCallbackCreate() throws HTTPError, NotCreated, NoResultsFound, MultipleResultsFound {
        Callback.Collection callbacks = mp.callbacks;
        int total = callbacks.total();
        assertEquals(0, total);

        HashMap<String, Object> callbackPayload = new HashMap<String, Object>();
        callbackPayload.put("url", "http://www.example.com/cb");
        callbackPayload.put("method", "post");

        Callback callback = new Callback(callbackPayload);
        callback.save();

        callback.reload();
        mp.reload();

        assertEquals(mp.callbacks.total(), 1);
        assertEquals("http://www.example.com/cb", callback.url);
        assertEquals("post", callback.method);

        callback.delete();
        mp.reload();

        assertEquals(mp.callbacks.total(), 0);
    }

    @Test
    public void testCallbacksResourceFields() throws HTTPError {
        HashMap<String, Object> payload = new HashMap<String, Object>();
        payload.put("url", "http://www.example.com/callback");
        payload.put("method", "post");

        Callback callback = new Callback(payload);
        callback.save();

        assertTrue(callback.href.contains("/callbacks/CB"));
        assertTrue(callback.id.contains("CB"));
        assertEquals(callback.method, "post");
        assertEquals(callback.revision.toString(), "1.1");
        assertEquals(callback.url, "http://www.example.com/callback");
    }
}
{'fraction_non_alphanumeric': 0.12949039264828738, 'fraction_numerical': 0.002227791701475912, 'mean_word_length': 3.2308598351001176, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 7, 'xml': 0}, 'pii_count': 0, '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': '1081650', 'n_tokens_mistral': 955, 'n_tokens_neox': 932, 'n_words': 196}