Pointing a [sub]domain to an IP address is easy, because resolving a hostname to an IP address is part of the normal procedure for making a HTTP connection.
Pointing an IP address to another domain name would really require introducing another round of DNS resolution into the process. That could be done at the HTTP protocol level: that's what HTTP redirect is... but that would require controlling the destination system at the 42.42.42.42 IP address. Any lower protocol layers don't really have the capability to introduce another round of DNS resolution. But if you look up the IP address of test.example.com in advance, substituting its IP address in place of 42.42.42.42 is possible.
If you want to redirect an IP address, you'll pretty much need to control either the client system, its network, or the system holding the IP address you wish to redirect. Since you said you don't control the target IP address, you'll need to do it client-side.
If you control the client system, you could use an iptables
DNAT rule(s) in the OUTPUT rule chain to redirect traffic from 42.42.42.42 to the target FQDN. If you do that, the name resolution for the target FQDN only happens once, when you configure the rule: so the redirection is really substituting one IP address for another. The rule on the client would be like this:
iptables -t nat -A OUTPUT -p tcp -d 42.42.42.42 --dport 80 -j DNAT --to-destination test.example.com:80
If you control the client's network, then you also have the option of doing the redirection in a regular WWW proxy (if the client is configured to use a proxy you can control), or a transparent proxy (if there is no explicit proxy configuration in the client).