package MailScanner::Test;

use MailScanner;
use base MailScanner;

use strict;
use warnings;

use Class::Std::Utils;
{
    sub connect
    {
        return 1;
    }
    
	sub getCandidateMessageNumbers
	{
		return ( 0 );
	}
	
	sub getMessageHeaders
	{
		my ( $self ) = @_;
		my $header = Email::Simple->new( $self->getRawMessage() )->header_obj();
		my $headers_ref = {};
        my %header_pairs = $header->header_pairs();
        
		while ( my ( $key, $value ) = each( %header_pairs ) ) {
			$headers_ref->{ $key } = [ $value ];
		}
		
		return $headers_ref;
	}
	
	sub getRawMessage
	{
		my $raw;
		
		{
			open my $fh, "<", "/tmp/test.eml" or die;
			local $/ = undef;
			$raw = <$fh>;
			close $fh;
		}
		
		return $raw;
	}
}

1;
