Assertion failed error null

g_dbus_method_invocation_take_error: assertion ‘error != NULL’ failed #725 Comments Hi, I have two problem when configure l2tp/ipsec with script provided by hwdsl2. First, I was connected to my vpn server from mikrotik and my android phone. But I could not connect to my vpn server on my ubuntu 18.04 (l2tp-gnome) with syslog error like this: […]

Содержание

  1. g_dbus_method_invocation_take_error: assertion ‘error != NULL’ failed #725
  2. Comments
  3. A solution for MySQL Assertion failure FIL_NULL

g_dbus_method_invocation_take_error: assertion ‘error != NULL’ failed #725

Hi, I have two problem when configure l2tp/ipsec with script provided by hwdsl2.

First, I was connected to my vpn server from mikrotik and my android phone. But I could not connect to my vpn server on my ubuntu 18.04 (l2tp-gnome) with syslog error like this:

Second question: How to connecting each users of my vpn server?
If I connect two devices to same vpn server, on my vpn server will create two pp interfaces. So, both devices can not connect to each other. Is it an error? Or indeed like that by default?
What’s the solution to connecting each vpn users?

The text was updated successfully, but these errors were encountered:

@xdnroot Hello! Using Ubuntu 18.04 as an IPsec VPN client has been tested and confirmed working. Please upgrade the following packages on your Ubuntu desktop (VPN client) using apt , then try again by following these instructions [1].

After connecting to the VPN server, IPsec/L2TP VPN clients can ping each other using their assigned internal VPN IPs, for example, 192.168.42.10 .

I’m actually having this same issue, following the instructions and the udp 1701 fix.

My packages are up to date, using Lubuntu but it should be the same as Ubuntu essentially.

Actually, my issue was I forgot to open ports 500+4500 on the network ACLs 😉

hey @brendan-mccoy , could you tell more about how you fixed the issue? I met exactly the same problem as you posted. By «open ports 500+4500 on the network ACLs», do you mean your local ufw firewall settings, or your VPN server side’s config? thanks a lot in advance!

My client was on a network that I had locked down, so I had to add a rule to my network level firewall to allow the server to egress using those ports.

So in the case of seeing those messages it’s likely a network issue SOMEWHERE, so I’d just double-check your server, client, and any intermediary firewalls to confirm those ports are open.

Источник

A solution for MySQL Assertion failure FIL_NULL

A defective RAM module recently caused data corruption in MySQL tables. MySQL would log the following to /var/log/syslog in regular intervals, about every few minutes:

Reading MySQL documentation and various blogs didn’t help much. I ran CHECK TABLES on all the tables and they all reported OK. Then I ran

and still all tables reported OK. Nevertheless the Assertion Failures continued. Then I stumbled across this excellent blog post, which suggested to dump evertying into a .sql file, wipe /var/lib/mysql (not without making a backup, mind you!), and re-import everything from scratch. This is what I did and it worked.

I recorded the passwords for each database and collected it into a SQL script like this:

When you dump all databases into a .sql file, it will not dump the permissions, so you will need to restore them later with this script. Next, the dumping part, then removal and reinstallation of mysql (Danger here: When you remove mysql-server, all packges which depend on it also will be removed!):

Here, I had to reset the MySQL admin password because it didn’t work any more, so I ran:

Then, I re-imported all databases from the dump file:

Then I run the SQL permission script that I mention above.

For me, this resulted in no more Assertion Failures. Yay!

Источник

I’m actually having this same issue, following the instructions and the udp 1701 fix.

Mar 16 11:44:09 reno NetworkManager[515]: <info>  [1615909449.0234] audit: op="connection-activate" uuid="5328d697-dcf8-44bb-be7a-452af41a964d" name="VPN connection 1" pid=956 uid=1000 result="success"
Mar 16 11:44:09 reno NetworkManager[515]: <info>  [1615909449.0272] vpn-connection[0x55dd7299c780,5328d697-dcf8-44bb-be7a-452af41a964d,"VPN connection 1",0]: Started the VPN service, PID 1654
Mar 16 11:44:09 reno NetworkManager[515]: <info>  [1615909449.0359] vpn-connection[0x55dd7299c780,5328d697-dcf8-44bb-be7a-452af41a964d,"VPN connection 1",0]: Saw the service appear; activating connection
Mar 16 11:44:09 reno NetworkManager[515]: <info>  [1615909449.0431] vpn-connection[0x55dd7299c780,5328d697-dcf8-44bb-be7a-452af41a964d,"VPN connection 1",0]: VPN connection: (ConnectInteractive) reply received
Mar 16 11:44:09 reno nm-l2tp-service[1654]: Check port 1701
Mar 16 11:44:09 reno NetworkManager[1668]: Stopping strongSwan IPsec failed: starter is not running
Mar 16 11:44:11 reno NetworkManager[1665]: Starting strongSwan 5.8.2 IPsec [starter]...
Mar 16 11:44:11 reno NetworkManager[1665]: Loading config setup
Mar 16 11:44:11 reno NetworkManager[1665]: Loading conn '5328d697-dcf8-44bb-be7a-452af41a964d'
Mar 16 11:44:11 reno charon: 00[DMN] Starting IKE charon daemon (strongSwan 5.8.2, Linux 5.8.0-45-generic, x86_64)
Mar 16 11:44:11 reno charon: 00[CFG] loading ca certificates from '/etc/ipsec.d/cacerts'
Mar 16 11:44:11 reno charon: 00[CFG] loading aa certificates from '/etc/ipsec.d/aacerts'
Mar 16 11:44:11 reno charon: 00[CFG] loading ocsp signer certificates from '/etc/ipsec.d/ocspcerts'
Mar 16 11:44:11 reno charon: 00[CFG] loading attribute certificates from '/etc/ipsec.d/acerts'
Mar 16 11:44:11 reno charon: 00[CFG] loading crls from '/etc/ipsec.d/crls'
Mar 16 11:44:11 reno charon: 00[CFG] loading secrets from '/etc/ipsec.secrets'
Mar 16 11:44:11 reno charon: 00[CFG] loading secrets from '/etc/ipsec.d/ipsec.nm-l2tp.secrets'
Mar 16 11:44:11 reno charon: 00[CFG]   loaded IKE secret for %any
Mar 16 11:44:11 reno charon: 00[LIB] loaded plugins: charon aesni aes rc2 sha2 sha1 md5 mgf1 random nonce x509 revocation constraints pubkey pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshkey pem openssl fips-prf gmp agent xcbc hmac gcm drbg attr kernel-netlink resolve socket-default connmark stroke updown eap-mschapv2 xauth-generic counters
Mar 16 11:44:11 reno charon: 00[LIB] dropped capabilities, running as uid 0, gid 0
Mar 16 11:44:11 reno charon: 00[JOB] spawning 16 worker threads
Mar 16 11:44:11 reno charon: 04[CFG] received stroke: add connection '5328d697-dcf8-44bb-be7a-452af41a964d'
Mar 16 11:44:11 reno charon: 04[CFG] added configuration '5328d697-dcf8-44bb-be7a-452af41a964d'
Mar 16 11:44:12 reno charon: 06[CFG] rereading secrets
Mar 16 11:44:12 reno charon: 06[CFG] loading secrets from '/etc/ipsec.secrets'
Mar 16 11:44:12 reno charon: 06[CFG] loading secrets from '/etc/ipsec.d/ipsec.nm-l2tp.secrets'
Mar 16 11:44:12 reno charon: 06[CFG]   loaded IKE secret for %any
Mar 16 11:44:12 reno charon: 08[CFG] received stroke: initiate '5328d697-dcf8-44bb-be7a-452af41a964d'
Mar 16 11:44:12 reno charon: 02[IKE] initiating Main Mode IKE_SA 5328d697-dcf8-44bb-be7a-452af41a964d[1] to REDACTED
Mar 16 11:44:12 reno charon: 02[ENC] generating ID_PROT request 0 [ SA V V V V V ]
Mar 16 11:44:12 reno charon: 02[NET] sending packet: from REDACTED[500] to REDACTED[500] (240 bytes)
Mar 16 11:44:16 reno charon: 13[IKE] sending retransmit 1 of request message ID 0, seq 1
Mar 16 11:44:16 reno charon: 13[NET] sending packet: from REDACTED[500] to REDACTED[500] (240 bytes)
Mar 16 11:44:19 reno systemd-resolved[472]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Mar 16 11:44:19 reno systemd-resolved[472]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Mar 16 11:44:22 reno NetworkManager[1708]: Stopping strongSwan IPsec...
Mar 16 11:44:22 reno charon: 00[DMN] signal of type SIGINT received. Shutting down
Mar 16 11:44:22 reno charon: 00[IKE] destroying IKE_SA in state CONNECTING without notification
Mar 16 11:44:22 reno NetworkManager[1706]: initiating Main Mode IKE_SA 5328d697-dcf8-44bb-be7a-452af41a964d[1] to REDACTED
Mar 16 11:44:22 reno NetworkManager[1706]: generating ID_PROT request 0 [ SA V V V V V ]
Mar 16 11:44:22 reno NetworkManager[1706]: sending packet: from REDACTED[500] to REDACTED[500] (240 bytes)
Mar 16 11:44:22 reno NetworkManager[1706]: sending retransmit 1 of request message ID 0, seq 1
Mar 16 11:44:22 reno NetworkManager[1706]: sending packet: from REDACTED[500] to REDACTED[500] (240 bytes)
Mar 16 11:44:22 reno NetworkManager[1706]: destroying IKE_SA in state CONNECTING without notification
Mar 16 11:44:22 reno NetworkManager[1706]: establishing connection '5328d697-dcf8-44bb-be7a-452af41a964d' failed
Mar 16 11:44:22 reno nm-l2tp-service[1654]: g_dbus_method_invocation_take_error: assertion 'error != NULL' failed
Mar 16 11:44:22 reno NetworkManager[515]: <info>  [1615909462.2087] vpn-connection[0x55dd7299c780,5328d697-dcf8-44bb-be7a-452af41a964d,"VPN connection 1",0]: VPN service disappeared
Mar 16 11:44:22 reno NetworkManager[515]: <warn>  [1615909462.2096] vpn-connection[0x55dd7299c780,5328d697-dcf8-44bb-be7a-452af41a964d,"VPN connection 1",0]: VPN connection: failed to connect: 'Message recipient disconnected from message bus without replying'
Mar 16 11:44:32 reno systemd-resolved[472]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.

My packages are up to date, using Lubuntu but it should be the same as Ubuntu essentially.

network-manager-l2tp is already the newest version (1.2.16-1).
network-manager-l2tp-gnome is already the newest version (1.2.16-1).
xl2tpd is already the newest version (1.3.12-1.1).
strongswan is already the newest version (5.8.2-1ubuntu3.1).
  • Remove From My Forums
  • Question

  • Hi All,

    This is my first post here. My application is throwing Debug Assertion Failed. Invalid Null pointer error. I have no idea what wrong i am doing. Below is the main method of my application. Obviously, there are other parts to the code as well but i would
    not post that and hope i have problem in main method and you guys are able to me help me with it :). Thanks

        std::string image_name;
        std::vector<std::string> image_names;
        char* folder_location = argv[1];
        std::string folder_location_str (folder_location);
        std::list<TextureAtlas *> atlases ;

        WIN32_FIND_DATA ffd;
        TCHAR szDir[MAX_PATH];
        size_t length_of_arg;
        HANDLE hFind = INVALID_HANDLE_VALUE;
        LARGE_INTEGER filesize;
        DWORD dwError=0;

        if(argc != 2)
        {
            _tprintf(TEXT(«nUsage: %s <directory name>n»), argv[0]);
            return (-1);
        }
        StringCbLength(folder_location, MAX_PATH, &length_of_arg);

        if (length_of_arg > (MAX_PATH — 3))
        {
            _tprintf(TEXT(«nDirectory path is too long.n»));
            return (-1);
        }

        _tprintf(TEXT(«nTarget directory is %snn»), argv[1]);
        StringCbCopy(szDir, MAX_PATH, argv[1]);
        StringCbCat(szDir, MAX_PATH, TEXT(«\*»));

        hFind = FindFirstFile(szDir, &ffd);

        do
        {
            if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
            {
                _tprintf(TEXT(»  %s   <DIR>n»), ffd.cFileName);
            }
            else
            {
                filesize.LowPart = ffd.nFileSizeLow;
                filesize.HighPart = ffd.nFileSizeHigh;
                image_name = ffd.cFileName;

                image_names.push_back (image_name);
            }
        }
        while (FindNextFile(hFind, &ffd) != 0);

        FindClose(hFind);

       
        size_t idx;
        // create the initial texture
        atlases.push_back(new TextureAtlas( image_names.size()));
        //    load the texture
        for (idx = 0; idx < image_names.size(); ++idx) {

            //load the image
            TextureInformation *ti = new TextureInformation (idx, folder_location_str, image_names[idx]);

            for(std::list<TextureAtlas *>::iterator atlases_iter = atlases.begin();
                    atlases_iter != atlases.end();
                    atlases_iter++)
            {
                TextureAtlas* tai = *atlases_iter;
                if (tai->addTexture(ti))
                    break;

            }
        }

        //int idx = 0;
        for(std::list<TextureAtlas *>::iterator atlases_iter = atlases.begin();
                atlases_iter != atlases.end();
                atlases_iter++)
        {
            TextureAtlas* tai = *atlases_iter;
            // Set the atlas name
            // calling some methods……
        }

        
    }

Answers

  • salmanmanekia wrote:

    This is my first post here. My application is throwing Debug Assertion  Failed. Invalid Null pointer error.

    char* folder_location = argv[1];
    std::string folder_location_str (folder_location);

    Do you actually pass a command line parameter to the application? What’s  the value of argc?

    if(argc != 2)

    Too late. You may have already passed an invalid pointer to  std::string’s construtor, causing your program to crash.


    Igor Tandetnik

    • Marked as answer by

      Tuesday, September 11, 2012 3:55 PM

  • On 9/11/2012 11:45 AM, salmanmanekia wrote:

    i am new to visual studio, maybe i should have mentioned that when i run the application with the play button it just exectues fine with the right result, this happens when i click on the .exe in my project->debug folder.

    … in which case the application is executed with no command line parameters, leading to the crash as explained earlier.


    Igor Tandetnik

    • Marked as answer by
      salmanmanekia
      Tuesday, September 11, 2012 3:55 PM

Наши новости:

> Информационная доска

Данный раздел предназначен для обсуждения, а также решения технических проблем связанных с серверной частью. Обсуждения касательно игровых клиентов ведутся здесь.

1. Во время создания новой темы аккуратно оформляйте её, не допускайте грамматических ошибок.
2. Описывая проблему старайтесь, как можно больше рассказать о ней, а так же о действиях с сервером после которых она возникла, по возможности подкрепите информацию логами.
3. Если вопрос касается проблемы в работе сервера, то обязательно прикрепляйте список плагинов (введите в консоли

сервера

: meta list и amxx plugins), настройки server.cfg, логи. Так же указывайте операционную систему, версию HLDS (введите к консоли сервера: version) и где хостится сервер.

Длинную информацию скрывайте под спойлер.

Раскрутка Counter-Strike 1.6

Ошибка в консоле

, cminterface.cpp (538) : Assertion Failed: NULL != m_hConnection

Статус пользователя

Mol

сообщение
6.10.2008, 21:45

Сообщение
#1



Здраствуйте. При вклю4ение сервера в консоле пишет:

cminterface.cpp (538) : Assertion Failed: NULL != m_hConnection

Если запустить сперва этот сервер, а патом другой то ошибка будет на другом. Сервера держатся на портах:

27015* -console -game cstrike +map cs_mansion +port 27015 +maxplayers 28 +server.cfg

27016* -console -game cstrike +map cs_mansion +port 27016 +maxplayers 28 +server.cfg

Cпасибо.

!

Аккаунт пользователя заблокирован до: 27.1.4747, 19:13

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

Цитировать сообщение

Статус пользователя

shadowhunter

сообщение
6.10.2008, 23:48

Сообщение
#2

Стаж: 14 лет

Сообщений: 1001

Благодарностей: 656

Полезность: 746


Ты запускаешь сервера с ожной кс?

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

Поблагодарили 1 раз

+

Цитировать сообщение

Статус пользователя

Mol

сообщение
7.10.2008, 5:00

Сообщение
#3

Стаж: 14 лет

Сообщений: 159

Благодарностей: 14

Полезность: < 0


С разных.

!

Аккаунт пользователя заблокирован до: 27.1.4747, 19:13

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

+

Цитировать сообщение

Статус пользователя

Mol

сообщение
9.10.2008, 23:35

Сообщение
#4

Стаж: 14 лет

Сообщений: 159

Благодарностей: 14

Полезность: < 0


не кто не знает ?(

!

Аккаунт пользователя заблокирован до: 27.1.4747, 19:13

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

+

Цитировать сообщение

Статус пользователя

pike

сообщение
10.10.2008, 6:39

Сообщение
#5

Стаж: 15 лет

Сообщений: 956

Благодарности: выкл.


Из-за этого что то не так работает ?
Может просто ругается на NoSteam.

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

+

Цитировать сообщение

Статус пользователя

Mr.Dmitry

сообщение
10.10.2008, 11:12

Сообщение
#6

Стаж: 16 лет

Сообщений: 3992

Благодарностей: 853

Полезность: 463


Цитата(Mol @ 6.10.2008, 21:45) *

Здраствуйте. При вклю4ение сервера в консоле пишет:

cminterface.cpp (538) : Assertion Failed: NULL != m_hConnection

Если запустить сперва этот сервер, а патом другой то ошибка будет на другом. Сервера держатся на портах:

27015* -console -game cstrike +map cs_mansion +port 27015 +maxplayers 28 +server.cfg

27016* -console -game cstrike +map cs_mansion +port 27016 +maxplayers 28 +server.cfg

Cпасибо.

Если это не кретично попробуй сервы переставить

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

Поблагодарили 1 раз

+

Цитировать сообщение

Статус пользователя

Mol

сообщение
10.10.2008, 17:09

Сообщение
#7

Стаж: 14 лет

Сообщений: 159

Благодарностей: 14

Полезность: < 0


Пробовал… из за этой пурги ис4езла VAC

!

Аккаунт пользователя заблокирован до: 27.1.4747, 19:13

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

+

Цитировать сообщение

Статус пользователя

Deag1y

сообщение
11.10.2008, 3:07

Сообщение
#8

Стаж: 15 лет

Сообщений: 1733

Благодарностей: 771

Полезность: 851


у тебя ещё и Steam? =

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

Поблагодарили 1 раз

+

Цитировать сообщение

Статус пользователя

Mol

сообщение
11.10.2008, 9:46

Сообщение
#9

Стаж: 14 лет

Сообщений: 159

Благодарностей: 14

Полезность: < 0


Да… есть CW*Serv он Steam…

!

Аккаунт пользователя заблокирован до: 27.1.4747, 19:13

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

+

Цитировать сообщение

Статус пользователя

Deag1y

сообщение
11.10.2008, 12:52

Сообщение
#10

Стаж: 15 лет

Сообщений: 1733

Благодарностей: 771

Полезность: 851


а эти 2 сервера не Steam? тогда почему ты печёшься о VAC? он же не работает всё равно :

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

Поблагодарили 1 раз

+

Цитировать сообщение

Статус пользователя

Mol

сообщение
11.10.2008, 20:25

Сообщение
#11

Стаж: 14 лет

Сообщений: 159

Благодарностей: 14

Полезность: < 0


Иногда я второй офлайню… запускаю CW^S там соответсвенно не запускается VAC..

надо решить это трудность, раньше же всё было гуд.. а сей4ас эта

CreateBoundSocket: ::bind returned Win32 error 10022 cminterface.cpp (876) : Assertion Failed: Null != m_hConnection

Отредактировал: Mol, — 12.10.2008, 14:52

!

Аккаунт пользователя заблокирован до: 27.1.4747, 19:13

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

+

Цитировать сообщение

Статус пользователя

jtiq

сообщение
28.3.2009, 21:44

Сообщение
#12

Иконка группы

Стаж: 15 лет

Сообщений: 1717

Благодарностей: 767

Полезность: 979

Меценат Меценат


у меня чё то тоже эта шняга появлятся начала ***

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

+

Цитировать сообщение

Статус пользователя

Mr.Dmitry

сообщение
28.3.2009, 22:32

Сообщение
#13

Стаж: 16 лет

Сообщений: 3992

Благодарностей: 853

Полезность: 463


Цитата(AxuJIJI @ 28.3.2009, 21:44) *

у меня чё то тоже эта шняга появлятся начала мля

У тебя тоже steam сервер?

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

+

Цитировать сообщение

Статус пользователя

jtiq

сообщение
28.3.2009, 23:36

Сообщение
#14

Иконка группы

Стаж: 15 лет

Сообщений: 1717

Благодарностей: 767

Полезность: 979

Меценат Меценат


нет, обычный с патчем на два протокола

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

+

Цитировать сообщение

Статус пользователя

METAJIJI

сообщение
9.6.2009, 22:07

Сообщение
#15

Стаж: 14 лет

Сообщений: 6

Благодарностей: 1

Полезность: 0


Тоже самое наблюдается на чистом Linux сервере БЕЗ патчей и т.д…
Поискал по интернету, пишут, что нужно +ip xxx.xxx.xx.xx писать ПОСЛЕ +map источник

Пробовал и до, и после ставить, ничего не помогло, интересно кто-нибудь нашел где грабли?

Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение

+

Цитировать сообщение

0 пользователей и 1 гостей читают эту тему:

  • Solved Questions
  • This Question

tsalbtsalb

Test — Assertion Failed: Expected:null

I need some help wrapping my head around testing this trigger — I seem to have prepared and inserted my dataset correct, but I’m not sure why it’s giving me an error of «Expected:Null».

My Trigger (working in sandbox, manually inserting records)

trigger AddCountyId on Contact (before insert, before update) {
	
    Set<String> CountyIds = new Set<String>();
    
    for(Contact c : Trigger.new) {       
       CountyIds.add(c.fdicCountyID__c);       
    }       
    
    Map<String, Id> countyMap = new Map<String,Id>();

	//Add both sets of IDS to above Map
	for(County__c cty : [SELECT cty.Id, cty.fdicCountyID__c
		FROM County__c cty
		WHERE cty.fdicCountyID__c != null AND cty.fdicCountyID__c IN :CountyIds]) {
    		countyMap.put(cty.fdicCountyID__c, cty.Id);
		}    
  
  	//Update Primary County on the Contact with County ID
    for(Contact updateC : Trigger.new) {
	    try {    
	          if(updateC.fdicCountyID__c != null) {
	  			  //Update Primary County with County Id from Map
	              updateC.Primary_County__c = countyMap.get(updateC.fdicCountyID__c);
	          }
	    }  
	    catch (Exception e) {
	   	}
	}

}

Stripped down test method in my test class

	static testMethod void verifyCountyId() {
		
		//Create Test County
  		County__c cty = new County__c(Name='Test County', Latitude__c = 1, Longitude__c = 1, fdicCountyId__c ='abcd1234');
  		insert cty;
		
		//Create Test Vendor
		Account vAcct = new Account(Name = 'Test Vendor Account');
		insert vAcct;
		Contact v = new Contact(LastName = 'Vendor Demo', last_engaged_date__c = Date.today(), AccountId = vAcct.Id, fdicCountyId__c = 'abcd1234');
		insert v;
		
		System.assertEquals (v.Primary_County_ID__c, cty.Id);
	}

 I get a System.AssertException: Assertion Failed: Expected:null Actual: a0hJ000000FymvMac 

Does anyone have any insight as to what i’m doing wrong?

You need to sign in to do that.

Dismiss

I’m currently trying to test my trigger but it keeps expecting null instead of date.today(). Can anyone help me?

Trigger:

Trigger UpdateLastSurveySent on Case (after insert, after update) {
    List<Account> accList = [SELECT Id FROM Account WHERE Last_Survey_Sent__c < LAST_N_DAYS:30 or Last_Survey_Sent__c = null];
    for (Case c : Trigger.new) {
        if (c.Status == 'Closed' || c.Status == 'Closed - Pending Approval') {
            c.Last_Survey_Sent__c = date.today();
            Account acc = new Account(
                Id = c.Account.Id,
                Last_Survey_Sent__c = c.Last_Survey_Sent__c
            );
            accList.add(acc);
        }
    }
    try {
        update accList;
    } catch (Exception ex) {
        System.debug('Update failed on Last Survey Sent field on Account with cause: ' + ex.getCause());
    }
}

Test class:

@IsTest    
public class UpdateSurvey {
    @isTest static void testLastSurveySent() {

        Account acc = new Account(
           Name = 'Test Account',
           Website = 'www.test.com',
           Phone = '8888888888'
        );
        insert acc;
        Case c = new Case(
            AccountId = acc.Id,
            Last_Survey_Sent__c = Date.Today()
        );
        insert c;

        // Test on account for insert
        Account accTest = [SELECT Id, Last_Survey_Sent__c FROM Account WHERE Id = :acc.id];
        System.assertEquals(accTest.Last_Survey_Sent__c, Date.Today());

        // Test on account for update
        c.Last_Survey_Sent__c = Date.Today()+1;
        update c;
        accTest = [SELECT Id, Last_Survey_Sent__c FROM Account WHERE Id = :acc.id];
        System.assertEquals(accTest.Last_Survey_Sent__c, Date.Today());
    }
}

Keith C's user avatar

Keith C

132k24 gold badges183 silver badges386 bronze badges

asked Oct 23, 2014 at 19:58

Brian Nguyen's user avatar

6

You have your assert parameters backwards. The first parameter is what you want to be true. The second parameter is the one you are checking against the first. That won’t solve the issue with your value being null, but it will at least make the expected value correct.

answered Oct 23, 2014 at 21:06

Andrew Monshizadeh's user avatar

5

Based on your comment, I think your trigger should look more like this (untested code):

trigger UpdateLastSurveySent on Case (before insert, before update) {
    Set<Id> accountIds = new Set<Id>();
    for (Case c : Trigger.new) {
        if (c.AccountId != null) {
            accountIds.add(c.AccountId);
        }
    }
    Map<Id, Account> accounts = new Map<Id, Account>([
            SELECT Id
            FROM Account
            WHERE Id in :accountIds
            AND (Last_Survey_Sent__c < LAST_N_DAYS:30 OR Last_Survey_Sent__c = null)
            ]);
    Account[] updates = new Account[] {};
    for (Case c : Trigger.new) {
        if (c.Status == 'Closed' || c.Status == 'Closed - Pending Approval') {
            if (c.AccountId != null && c.Last_Survey_Sent__c != Date.today()) {
                Account a = accounts.get(c.AccountId);
                if (a != null) {
                    c.Last_Survey_Sent__c = Date.today();
                    a.Last_Survey_Sent__c = Date.today();
                    updates.add(a);
                }
            }
        }
    }
    update updates;
}

answered Oct 23, 2014 at 21:38

Keith C's user avatar

Keith CKeith C

132k24 gold badges183 silver badges386 bronze badges

3

Your test class is failing because you’re trigger only works on cases with a status of «Closed» or «Closed — Pending Approval», but the case creating by your test method does not set the status.

answered Oct 23, 2014 at 23:04

Ralph Callaway's user avatar

Ralph CallawayRalph Callaway

24.1k13 gold badges103 silver badges183 bronze badges

Понравилась статья? Поделить с друзьями:
  • Assertion error казаки 2
  • Assert param error
  • Assert failed getprop ro product device как исправить
  • Assert efi error status invalid parameter
  • Assembly referencing error people playground