|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2010 the original author or authors. |
|
|
|
* Copyright 2002-2011 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -23,12 +23,13 @@ import java.util.Comparator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Random; |
|
|
|
import java.util.Random; |
|
|
|
|
|
|
|
|
|
|
|
import static org.junit.Assert.*; |
|
|
|
|
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.core.convert.ConversionService; |
|
|
|
import org.springframework.core.convert.ConversionService; |
|
|
|
import org.springframework.core.convert.support.ConversionServiceFactory; |
|
|
|
import org.springframework.core.convert.support.ConversionServiceFactory; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.junit.Assert.*; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author Arjen Poutsma |
|
|
|
* @author Arjen Poutsma |
|
|
|
* @author Juergen Hoeller |
|
|
|
* @author Juergen Hoeller |
|
|
|
@ -127,6 +128,11 @@ public class MediaTypeTests { |
|
|
|
MediaType.parseMediaType("audio/"); |
|
|
|
MediaType.parseMediaType("audio/"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
|
|
|
|
public void parseMediaTypeTypeRange() { |
|
|
|
|
|
|
|
MediaType.parseMediaType("*/json"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
@Test(expected = IllegalArgumentException.class) |
|
|
|
public void parseMediaTypeIllegalType() { |
|
|
|
public void parseMediaTypeIllegalType() { |
|
|
|
MediaType.parseMediaType("audio(/basic"); |
|
|
|
MediaType.parseMediaType("audio(/basic"); |
|
|
|
@ -496,4 +502,11 @@ public class MediaTypeTests { |
|
|
|
assertEquals(mediaType, conversionService.convert("application/xml", MediaType.class)); |
|
|
|
assertEquals(mediaType, conversionService.convert("application/xml", MediaType.class)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void isConcrete() { |
|
|
|
|
|
|
|
assertTrue("text/plain not concrete", MediaType.TEXT_PLAIN.isConcrete()); |
|
|
|
|
|
|
|
assertFalse("*/* concrete", MediaType.ALL.isConcrete()); |
|
|
|
|
|
|
|
assertFalse("text/* concrete", new MediaType("text", "*").isConcrete()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|