All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fuwjin.util.Matchers Maven / Gradle / Ivy

There is a newer version: 0.9.8.1
Show newest version
package org.fuwjin.util;

import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;

public class Matchers {
   public static Matcher stringValue(final T value) {
      return new BaseMatcher() {
         @Override
         public void describeTo(final Description description) {
            description.appendValue("(" + value.getClass().getCanonicalName() + ")" + value);
         }

         @Override
         public boolean matches(final Object item) {
            if(item == null) {
               return value == null;
            }
            if(value == null) {
               return false;
            }
            return item.getClass().equals(value.getClass()) && item.toString().equals(value.toString());
         }
      };
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy